From 86e1f022e2928f87d8f5e58ced399eaf8ad9f79c Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 23 May 2016 21:35:58 +0200 Subject: [PATCH] http: http_nonce_exists - fix possible string overflow - coverity --- src/http.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/http.c b/src/http.c index 2525ac4ff..b62ed9137 100644 --- a/src/http.c +++ b/src/http.c @@ -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) { -- 2.47.3