From f488aa69212d6f24b6cc94fab1c71eacd46bca76 Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Mon, 24 Oct 2022 22:35:09 +0200 Subject: [PATCH] Fix off-by-one when terminating gcm_nonce (#1039) The `gcm_nonce` character array is `12 + 1` chars long. Writing to `gcm_nonce[12 + 1]` overflows the array by one char. --- src/apps/oauth/oauth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/oauth/oauth.c b/src/apps/oauth/oauth.c index 010f45a1..700532ee 100644 --- a/src/apps/oauth/oauth.c +++ b/src/apps/oauth/oauth.c @@ -337,7 +337,7 @@ int main(int argc, char **argv) nonce_size=OAUTH_GCM_NONCE_SIZE; } strncpy(gcm_nonce,nonce_val,nonce_size); - gcm_nonce[ nonce_size + 1 ]='\0'; + gcm_nonce[ nonce_size ]='\0'; break; case 'p': //token-mac-key