Blob Blame History Raw

gcc -Wformat-truncation thinks this might truncate.

diff -uap memcached-1.4.34/util.c.gcc7fmt memcached-1.4.34/util.c
--- memcached-1.4.34/util.c.gcc7fmt
+++ memcached-1.4.34/util.c
@@ -18,7 +18,7 @@
         if (isalnum(x) || x == '-' || x == '.' || x == '_' || x == '~') {
             uriencode_map[x] = NULL;
         } else {
-            snprintf(str, 4, "%%%02X", x);
+            snprintf(str, 4, "%%%02hhX", (unsigned char)x);
             uriencode_map[x] = str;
             str += 3; /* lobbing off the \0 is fine */
         }