commit 49936d88d98b50a24d0ab9dee8ef31778ec9c167
parent af91748032f4e418adac004980160708e9323260
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 18 Nov 2018 12:03:16 +0100
fix format string, prefer snprintf
Diffstat:
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c
@@ -162,9 +162,10 @@ testDigestAuth ()
fd = open("/dev/urandom", O_RDONLY);
if (-1 == fd)
{
- fprintf(stderr, "Failed to open `%s': %s\n",
- "/dev/urandom",
- strerror(errno));
+ fprintf (stderr,
+ "Failed to open `%s': %s\n",
+ "/dev/urandom",
+ strerror(errno));
return 1;
}
while (off < 8)
@@ -172,9 +173,10 @@ testDigestAuth ()
len = read(fd, rnd, 8);
if (len == (size_t)-1)
{
- fprintf(stderr, "Failed to read `%s': %s\n",
- "/dev/urandom",
- strerror(errno));
+ fprintf (stderr,
+ "Failed to read `%s': %s\n",
+ "/dev/urandom",
+ strerror(errno));
(void) close(fd);
return 1;
}
@@ -218,7 +220,10 @@ testDigestAuth ()
{ MHD_stop_daemon (d); return 32; }
port = (int)dinfo->port;
}
- sprintf(url, "http://127.0.0.1:%d/bar%20foo%3Fkey%3Dvalue", port);
+ snprintf (url,
+ sizeof (url),
+ "http://127.0.0.1:%d/bar%%20foo%%3Fkey%%3Dvalue",
+ port);
c = curl_easy_init ();
curl_easy_setopt (c, CURLOPT_URL, url);
curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, ©Buffer);