From b3fb15ad36c2bb1903d18a2db7b52fffa7edb467 Mon Sep 17 00:00:00 2001 From: Karel Miko Date: Fri, 22 Jun 2018 09:55:11 +0200 Subject: [PATCH] fix #411 buffer overflow in crypt_list_all_constants --- src/misc/crypt/crypt_constants.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/misc/crypt/crypt_constants.c b/src/misc/crypt/crypt_constants.c index df8ab2d68..3e42c892c 100644 --- a/src/misc/crypt/crypt_constants.c +++ b/src/misc/crypt/crypt_constants.c @@ -271,8 +271,9 @@ int crypt_list_all_constants(char *names_list, unsigned int *names_list_size) { ((unsigned int)number_len >= sizeof(number))) return -1; total_len += number_len + 1; - /* this last +1 is for newlines (and ending NULL) */ + /* this last +1 is for newline */ } + total_len++; /* for the ending NUL */ if (names_list == NULL) { *names_list_size = total_len;