Browse code

jsonrpcc: use snprintf() instead of sprintf()

Daniel-Constantin Mierla authored on 02/12/2019 15:25:44
Showing 1 changed files
... ...
@@ -185,7 +185,7 @@ size_t netstring_encode_new(char **netstring, char *data, size_t len) {
185 185
 		LM_ERR("Out of memory!");
186 186
 		return 0;
187 187
 	}
188
-    sprintf(ns, "%lu:", (unsigned long)len);
188
+    snprintf(ns, num_len + len + 2, "%lu:", (unsigned long)len);
189 189
     memcpy(ns + num_len + 1, data, len);
190 190
     ns[num_len + len + 1] = ',';
191 191
   }