Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-bugs: [Wireshark-bugs] [Bug 7554] Add ability to add/remove packet comments using edit

Date: Thu, 2 Aug 2012 13:24:48 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7554

Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |darkjames-ws@xxxxxxxxxxxx

--- Comment #2 from Jakub Zawadzki <darkjames-ws@xxxxxxxxxxxx> 2012-08-02 13:24:48 PDT ---
Hi,

Some comments:
 - please use FILE API from stdio.h, and especially fgets().
   Yours fgets() have off-by-one error when comment takes COMMENT_READ_SIZE
bytes (NUL termination is written to buf[COMMENT_READ_SIZE]).

 - another off-by-one is in add_comment(), first comment is written at
commentfrm[1] and not commentfrm[0].


+ comment_phdr.opt_comment = g_strdup(comment_item->comment);
+ g_free(comment_item->comment);

I'd rather free memory (if you really need) at end of program, 
User can specify any packet number, (s)he can also specify frame number which
doesn't exists. In such case we won't free memory.


And finally I'd use NULL comment as indicator to remove comment, instead of
another 'remove' variable. But current version is ok for me.

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.