Skip to content

Commit

Permalink
ping_host_add: Decrease buffer size to make GCC's truncation check ha…
Browse files Browse the repository at this point in the history
…ppy.

Fixes: #38
  • Loading branch information
octo committed Jul 29, 2018
1 parent f9115d6 commit 18ca435
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/liboping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1636,10 +1636,8 @@ int ping_host_add (pingobj_t *obj, const char *host)
}
else
{
char errmsg[PING_ERRMSG_LEN];

snprintf (errmsg, PING_ERRMSG_LEN, "Unknown `ai_family': %i", ai_ptr->ai_family);
errmsg[PING_ERRMSG_LEN - 1] = '\0';
char errmsg[64];
snprintf (errmsg, sizeof(errmsg), "Unknown `ai_family': %d", ai_ptr->ai_family);

dprintf ("%s", errmsg);
ping_set_error (obj, "getaddrinfo", errmsg);
Expand Down

0 comments on commit 18ca435

Please sign in to comment.