udyfi

Small client for dy.fi (and possibly other services) DNS renewals
git clone https://git.inz.fi/udyfi/
Log | Files | Refs

commit 1ba17307f77c34ca1ed87dfc5233b6014888a817
parent 8adb0d2527090e48add742b8dad32a4ecf837775
Author: Santtu Lakkala <inz@inz.fi>
Date:   Wed,  5 Jul 2023 20:24:05 +0300

Fix potential buffer overflow

Diffstat:
Mudyfi.c | 5++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/udyfi.c b/udyfi.c @@ -393,11 +393,10 @@ static int check_ip(const char *server, iplen = strspn(ip, "0123456789a-fA-F:"); break; } - if (iplen > ip_size) + if (ip[-1] == '\n' && ip[iplen]) return -1; - if (ip == buffer && ip[iplen]) + if (snprintf(ip_buffer, ip_size, "%.*s", (int)iplen, ip) >= (int)ip_size) return -1; - sprintf(ip_buffer, "%.*s", (int)iplen, ip); return 0; }