Wireshark-bugs: [Wireshark-bugs] [Bug 3161] New: text2pcap.c define trickery breaks strdup() han

Date: Fri, 26 Dec 2008 01:00:10 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=3161

           Summary: text2pcap.c define trickery breaks strdup() handling
                    with recent glibc
           Product: Wireshark
           Version: SVN
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: Major
          Priority: Low
         Component: Wireshark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: vapier@xxxxxxxxxx


Build Information:
glibc-2.9
linux-2.6.28
gcc-4.3.2
--
the text2pcap.c file tries to setup defines it shouldnt be testing:
#ifndef __USE_XOPEN
#  define __USE_XOPEN
#endif

POSIX states that you should only be _XOPEN_SOURCE:
http://www.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html

with recent glibc versions, defining just _XOPEN_SOURCE results in the
prototype for strptime(), but the prototype for strdup() gets dropped.  thus
the implicit prototype has an "int" return value which is 32bits even on a
64bit system.  you can see how this quickly gets bad.

this is because the value of _XOPEN_SOURCE has meaning and simply defining it
says that it has a value of 0.  it should be defined to 600 or 700 in order for
things to work properly.

--- text2pcap.c
+++ text2pcap.c
@@ -90,7 +90,7 @@
 #  define __USE_XOPEN
 #endif
 #ifndef _XOPEN_SOURCE
-#  define _XOPEN_SOURCE
+#  define _XOPEN_SOURCE 600
 #endif

 #include <ctype.h>


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