gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] 19/31: testcurl/https: added proper check for snprintf()


From: gnunet
Subject: [libmicrohttpd] 19/31: testcurl/https: added proper check for snprintf() result
Date: Mon, 10 Oct 2022 13:01:04 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit 6e78e8022576955e89ff3626d9019320bd5d2228
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Thu Oct 6 19:13:52 2022 +0300

    testcurl/https: added proper check for snprintf() result
---
 src/testcurl/https/tls_test_common.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/testcurl/https/tls_test_common.c 
b/src/testcurl/https/tls_test_common.c
index 639bccf1..f27813a2 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -320,15 +320,18 @@ gen_test_file_url (char *url,
                    size_t url_len,
                    uint16_t port)
 {
-  unsigned int ret = 0;
-  /* construct url */
-  if ((size_t) snprintf (url,
-                         url_len,
-                         "https://127.0.0.1:%u/urlpath";,
-                         (unsigned int) port) >= url_len)
-    ret = 1;
+  int res;
 
-  return ret;
+  res = snprintf (url,
+                  url_len,
+                  "https://127.0.0.1:%u/urlpath";,
+                  (unsigned int) port);
+  if (res <= 0)
+    return 1;
+  if ((size_t) res >= url_len)
+    return 1;
+
+  return 0;
 }
 
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]