Wireshark-commits: [Wireshark-commits] rev 49731: /trunk/epan/ /trunk/epan/: prefs.c
Date: Mon, 03 Jun 2013 22:07:21 GMT
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=49731

User: morriss
Date: 2013/06/03 03:07 PM

Log:
 From Cal Turney via https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8707 :
 
 As suggested by Jakub, don't use strlen() when g_string->len will do.
 
 From me:
 
 Don't assume that just because we "got_val" that the value has a length.
 Checking it first eliminates this warning from Valgrind:
 
 ==11954== Invalid read of size 1
 ==11954==    at 0x61D1466: read_prefs_file (prefs.c:3012)
 ==11954==    by 0x61D1841: read_prefs (prefs.c:2955)
 ==11954==    by 0x409901: main (tshark.c:1137)
 ==11954==  Address 0xc05244f is 1 bytes before a block of size 16 alloc'd
 ==11954==    at 0x4A08A6E: realloc (vg_replace_malloc.c:662)
 ==11954==    by 0x3CF8C4D736: g_realloc (in /usr/lib64/libglib-2.0.so.0.3400.2)
 ==11954==    by 0x3CF8C66226: ??? (in /usr/lib64/libglib-2.0.so.0.3400.2)
 ==11954==    by 0x3CF8C66ACE: g_string_insert_c (in /usr/lib64/libglib-2.0.so.0.3400.2)
 ==11954==    by 0x61D1566: read_prefs_file (gstring.h:139)
 ==11954==    by 0x61D1841: read_prefs (prefs.c:2955)
 ==11954==    by 0x409901: main (tshark.c:1137)

Directory: /trunk/epan/
  Changes    Path          Action
  +12 -10    prefs.c       Modified