From 7c608c506465a633cc5e51f490a34b7c7ff301f9 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 24 Sep 2021 15:51:50 -0700 Subject: [PATCH] arp: fix the scanf %s numbers. Just like every other time I've used %s with scanf, I was off by one... The number _doesn't_ include the space for the NUL. --- toys/pending/arp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toys/pending/arp.c b/toys/pending/arp.c index 0f564288..5f7c4a1f 100644 --- a/toys/pending/arp.c +++ b/toys/pending/arp.c @@ -241,7 +241,7 @@ void arp_main(void) fp = xfopen("/proc/net/arp", "r"); fgets(toybuf, sizeof(toybuf), fp); // Skip header. - while (fscanf(fp, "%16s 0x%x 0x%x %30s %16s %16s", + while (fscanf(fp, "%15s 0x%x 0x%x %29s %15s %15s", ip, &h_type, &flag, hw_addr, mask, dev) == 6) { char *host_name = "?"; -- 2.39.2