diff options
author | Nick Mathewson <nickm@torproject.org> | 2018-09-05 08:30:35 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2018-09-05 08:30:35 -0400 |
commit | 3b61bdb5aebe3890443e39eed4d79da93aa19c8b (patch) | |
tree | 946b5a25ea856d027319d07cf7eaa6f1eebea4aa /src/test/test_tortls.c | |
parent | 03efb67b42ce88ca6073eadc1b66d6151d646607 (diff) | |
download | tor-3b61bdb5aebe3890443e39eed4d79da93aa19c8b.tar.gz tor-3b61bdb5aebe3890443e39eed4d79da93aa19c8b.zip |
Try to fix new coverity warnings in unit tests.
Diffstat (limited to 'src/test/test_tortls.c')
-rw-r--r-- | src/test/test_tortls.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c index 7ab4b5c2aa..f4315364a2 100644 --- a/src/test/test_tortls.c +++ b/src/test/test_tortls.c @@ -110,7 +110,11 @@ read_cert_from(const char *str) { size_t len = strlen(str); uint8_t *raw_cert = tor_malloc(len); - size_t true_len = pem_decode(raw_cert, len, str, len, "CERTIFICATE"); + ssize_t true_len = pem_decode(raw_cert, len, str, len, "CERTIFICATE"); + if (true_len < 0) { + tor_free(raw_cert); + return NULL; + } tor_x509_cert_t *cert = tor_x509_cert_decode(raw_cert, true_len); tor_free(raw_cert); if (! cert) { |