Commit ad8f1d88 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by Cesanta Bot

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
parent a3c4a48e
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment