Skip to content

Commit f901282

Browse files
committed
Comment buffer sizes better in pcap_nametoproto().
1 parent 4f9dbed commit f901282

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

nametoaddr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ pcap_nametoproto(const char *str)
487487
* We have Linux's reentrant getprotobyname_r().
488488
*/
489489
struct protoent result_buf;
490-
char buf[1024]; /* arbitrary size */
490+
char buf[1024]; // "...1024 bytes should be sufficient for most applications."
491491
int err;
492492

493493
err = getprotobyname_r(str, &result_buf, buf, sizeof buf, &p);
@@ -517,7 +517,7 @@ pcap_nametoproto(const char *str)
517517
* We have Solaris's reentrant getprotobyname_r().
518518
*/
519519
struct protoent result_buf;
520-
char buf[1024]; /* arbitrary size */
520+
char buf[1024]; // "...must be at least 1024 bytes."
521521

522522
p = getprotobyname_r(str, &result_buf, buf, (int)sizeof buf);
523523
#elif defined(HAVE_AIX_GETPROTOBYNAME_R)

0 commit comments

Comments
 (0)