diff options
author | Rob Crittenden <rcritten@redhat.com> | 2015-08-27 13:04:01 -0400 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2015-08-27 13:04:01 -0400 |
commit | 5bac18e93151bfb6a0aa9d7467d7d84e24989fae (patch) | |
tree | 06fbdd1ba9732cee69f4fd4bb22962e318f8e865 /test_cipher.c | |
parent | bb1011ce19730ec168512205dfcf5f0b5d9e4657 (diff) | |
download | mod_nss-5bac18e93151bfb6a0aa9d7467d7d84e24989fae.tar.gz mod_nss-5bac18e93151bfb6a0aa9d7467d7d84e24989fae.tar.xz mod_nss-5bac18e93151bfb6a0aa9d7467d7d84e24989fae.zip |
Fix usage of sizeof() within strncat to not overflow buffer
Diffstat (limited to 'test_cipher.c')
-rw-r--r-- | test_cipher.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test_cipher.c b/test_cipher.c index 86a88d6..97c8848 100644 --- a/test_cipher.c +++ b/test_cipher.c @@ -92,11 +92,11 @@ int main(int argc, char ** argv) { if (ciphers_list[i] == 1) { if (openssl_output) { - strncat(output, ciphers_def[i].openssl_name, sizeof(output)); - strncat(output, ":", sizeof(output)); + strncat(output, ciphers_def[i].openssl_name, sizeof(output) - strlen(output) -1); + strncat(output, ":", sizeof(output) - strlen(output) -1); } else { - strncat(output, ciphers_def[i].name, sizeof(output)); - strncat(output, ", ", sizeof(output)); + strncat(output, ciphers_def[i].name, sizeof(output) - strlen(output) -1); + strncat(output, ", ", sizeof(output) - strlen(output) -1); } } } |