From ad8f1d88d40ce878383fcbfc826adb2fdd2d3f78 Mon Sep 17 00:00:00 2001 From: Deomid Ryabkov Date: Tue, 13 Feb 2018 11:10:07 +0000 Subject: [PATCH] Fix buffer size passed to inet_ntop() Fixes https://github.com/cesanta/mongoose-os/issues/394 CL: Fix buffer size passed to inet_ntop() PUBLISHED_FROM=4a6702527627ccbb780f45200274b09a28be69ee --- mongoose.c | 2 +- src/mg_util.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mongoose.c b/mongoose.c index 141e5017..14a9218f 100644 --- a/mongoose.c +++ b/mongoose.c @@ -10093,7 +10093,7 @@ int mg_sock_addr_to_str(const union socket_address *sa, char *buf, size_t len, goto cleanup; } #else - if (inet_ntop(AF_INET, (void *) &sa->sin.sin_addr, buf, len - 1) == NULL) { + if (inet_ntop(AF_INET, (void *) &sa->sin.sin_addr, buf, len) == NULL) { goto cleanup; } #endif diff --git a/src/mg_util.c b/src/mg_util.c index 485ba276..95246a8d 100644 --- a/src/mg_util.c +++ b/src/mg_util.c @@ -144,7 +144,7 @@ int mg_sock_addr_to_str(const union socket_address *sa, char *buf, size_t len, goto cleanup; } #else - if (inet_ntop(AF_INET, (void *) &sa->sin.sin_addr, buf, len - 1) == NULL) { + if (inet_ntop(AF_INET, (void *) &sa->sin.sin_addr, buf, len) == NULL) { goto cleanup; } #endif