From 8f7b99f0f5ff6b7fbb1ea80d222fc2e56bf3cb48 Mon Sep 17 00:00:00 2001 From: Mark Liffiton Date: Sun, 21 Nov 2021 17:36:18 -0600 Subject: [PATCH] Reduce size of a buffer to quiet a spurious warning. Fixes #133. A recent compiler complains about the sprintf() in authenticate() being able to write up to 1023 bytes into challenge, which is not possible given that getChallenge() returns a string 10 bytes smaller than whatever string is in its 1024 byte buffer. Reducing the size of the buffer in getChallenge() quiets the warning. It should not affect anything else, as the challenge string is used as a salt that must be <= 96 bits. --- wiringPi/drcNet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wiringPi/drcNet.c b/wiringPi/drcNet.c index 0964ff7..0aa8a4f 100644 --- a/wiringPi/drcNet.c +++ b/wiringPi/drcNet.c @@ -76,12 +76,12 @@ static int remoteReadline (int fd, char *buf, int max) static char *getChallenge (int fd) { - static char buf [1024] ; + static char buf [512] ; int num ; for (;;) { - if ((num = remoteReadline (fd, buf, 1023)) < 0) + if ((num = remoteReadline (fd, buf, 511)) < 0) return NULL ; buf [num] = 0 ;