Skip to content

Commit

Permalink
Use correct width in sscanf. Fixes #1156
Browse files Browse the repository at this point in the history
  • Loading branch information
bonsaiviking committed Mar 22, 2018
1 parent 19ba606 commit 36a6d89
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions libdnet-stripped/NMAP_MODIFICATIONS
Original file line number Diff line number Diff line change
Expand Up @@ -2392,3 +2392,19 @@ Index: configure.in
fi

dnl Checks for typedefs, structures, and compiler characteristics.

o Ensure we read 1 byte less than buffer size to allow for automatically-appended null char.

diff --git a/libdnet-stripped/src/arp-ioctl.c b/libdnet-stripped/src/arp-ioctl.c
index 434142e..31b9f8c 100644
--- a/libdnet-stripped/src/arp-ioctl.c
+++ b/libdnet-stripped/src/arp-ioctl.c
@@ -218,7 +218,7 @@ arp_loop(arp_t *a, arp_handler callback, void *arg)

ret = 0;
while (fgets(buf, sizeof(buf), fp) != NULL) {
- i = sscanf(buf, "%s 0x%x 0x%x %100s %100s %100s\n",
+ i = sscanf(buf, "%s 0x%x 0x%x %99s %99s %99s\n",
ipbuf, &type, &flags, macbuf, maskbuf, devbuf);

if (i < 4 || (flags & ATF_COM) == 0)
2 changes: 1 addition & 1 deletion libdnet-stripped/src/arp-ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ arp_loop(arp_t *a, arp_handler callback, void *arg)

ret = 0;
while (fgets(buf, sizeof(buf), fp) != NULL) {
i = sscanf(buf, "%s 0x%x 0x%x %100s %100s %100s\n",
i = sscanf(buf, "%s 0x%x 0x%x %99s %99s %99s\n",
ipbuf, &type, &flags, macbuf, maskbuf, devbuf);

if (i < 4 || (flags & ATF_COM) == 0)
Expand Down

0 comments on commit 36a6d89

Please sign in to comment.