]> The Tcpdump Group git mirrors - libpcap/commitdiff
Comment buffer sizes better in pcap_nametoproto().
authorDenis Ovsienko <[email protected]>
Sun, 9 Mar 2025 14:45:48 +0000 (14:45 +0000)
committerDenis Ovsienko <[email protected]>
Sun, 9 Mar 2025 14:45:48 +0000 (14:45 +0000)
nametoaddr.c

index 342f95f38e4aee7c73bcc58d4135ea5366a45ccc..38f5c712c8c6ddba72bac3664a1a33acd9c726c6 100644 (file)
@@ -487,7 +487,7 @@ pcap_nametoproto(const char *str)
         * We have Linux's reentrant getprotobyname_r().
         */
        struct protoent result_buf;
-       char buf[1024]; /* arbitrary size */
+       char buf[1024]; // "...1024 bytes should be sufficient for most applications."
        int err;
 
        err = getprotobyname_r(str, &result_buf, buf, sizeof buf, &p);
@@ -517,7 +517,7 @@ pcap_nametoproto(const char *str)
         * We have Solaris's reentrant getprotobyname_r().
         */
        struct protoent result_buf;
-       char buf[1024]; /* arbitrary size */
+       char buf[1024]; // "...must be at least 1024 bytes."
 
        p = getprotobyname_r(str, &result_buf, buf, (int)sizeof buf);
   #elif defined(HAVE_AIX_GETPROTOBYNAME_R)