From efa339fff2de05131785bd0b3cf18a1e7c2c100a Mon Sep 17 00:00:00 2001 From: mrb0nk500 Date: Thu, 10 Jun 2021 23:43:15 -0400 Subject: Fixed a typo in `init_socket()`. Accidentally used `sprintf()`, instead of `snprintf()`. --- pullreqd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pullreqd.c b/pullreqd.c index a4501c6..d884d63 100644 --- a/pullreqd.c +++ b/pullreqd.c @@ -114,7 +114,7 @@ int init_socket(config *cfg) { return -1; } struct addrinfo hints, *ainfo_root, *ainfo; - const size_t size = sprintf(NULL, "%d", cfg->port) + 1; + const size_t size = snprintf(NULL, 0, "%d", cfg->port) + 1; char *port_str = malloc(size); sprintf(port_str, "%d", cfg->port); -- cgit v1.2.3-13-gbd6f