]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
http: http_nonce_exists - fix possible string overflow - coverity
authorJaroslav Kysela <perex@perex.cz>
Mon, 23 May 2016 19:35:58 +0000 (21:35 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 23 May 2016 19:35:58 +0000 (21:35 +0200)
src/http.c

index 2525ac4ff7c094d1c0585d78f90a2efc57ed6d44..b62ed9137c1ac486b700b240fabdba60e9206754 100644 (file)
@@ -280,7 +280,8 @@ http_nonce_exists(const char *nonce)
 
   if (nonce == NULL)
     return 0;
-  strcpy(tmp.nonce, nonce);
+  strncpy(tmp.nonce, nonce, sizeof(tmp.nonce)-1);
+  tmp.nonce[sizeof(tmp.nonce)-1] = '\0';
   pthread_mutex_lock(&global_lock);
   n = RB_FIND(&http_nonces, &tmp, link, http_nonce_cmp);
   if (n) {