diff options
author | Mukund Sivaraman <muks@banu.com> | 2009-11-17 01:44:21 +0530 |
---|---|---|
committer | Mukund Sivaraman <muks@banu.com> | 2009-11-17 01:44:21 +0530 |
commit | 4b6a25ac068e6dd686d1aae15f1d668b60c735c1 (patch) | |
tree | 2d6508cd546f5097f40dd166aa9a9edc38b75ae6 /src | |
parent | 238e3ffb3486e4f25e4f60b1bc2a61034178ed60 (diff) | |
download | tinyproxy-4b6a25ac068e6dd686d1aae15f1d668b60c735c1.tar.gz tinyproxy-4b6a25ac068e6dd686d1aae15f1d668b60c735c1.zip |
Use snprintf() with size of the portstr buf
Diffstat (limited to 'src')
-rw-r--r-- | src/sock.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -167,7 +167,7 @@ int socket_blocking (int sock) int listen_sock (uint16_t port, socklen_t * addrlen) { struct addrinfo hints, *result, *rp; - char portstr[32]; + char portstr[6]; int listenfd; const int on = 1; @@ -178,7 +178,7 @@ int listen_sock (uint16_t port, socklen_t * addrlen) hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - sprintf (portstr, "%6d", port); + snprintf (portstr, sizeof (portstr), "%d", port); if (getaddrinfo (config.ipAddr, portstr, &hints, &result) != 0) { log_message (LOG_ERR, |