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
This commit is contained in:
Deomid Ryabkov 2018-02-13 11:10:07 +00:00 committed by Cesanta Bot
parent a3c4a48ef7
commit ad8f1d88d4
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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