diff options
author | beck <> | 2014-04-16 20:36:35 +0000 |
---|---|---|
committer | beck <> | 2014-04-16 20:36:35 +0000 |
commit | 73c9e533da75d578dfa576ec1e77e6ad916c409f (patch) | |
tree | 4a8d2bd6f2dd786d658a75ea2db858806f2ec5f4 /src/lib/libcrypto/bio/bss_log.c | |
parent | 8b189af5cdd592787ead69f8a0f378727a24b473 (diff) | |
download | openbsd-73c9e533da75d578dfa576ec1e77e6ad916c409f.tar.gz openbsd-73c9e533da75d578dfa576ec1e77e6ad916c409f.tar.bz2 openbsd-73c9e533da75d578dfa576ec1e77e6ad916c409f.zip |
Clean up dangerous strncpy use. This included a use where the resulting
string was potentially not nul terminated and a place where malloc return
was unchecked.
while we're at it remove dummytest.c
ok miod@
Diffstat (limited to 'src/lib/libcrypto/bio/bss_log.c')
-rw-r--r-- | src/lib/libcrypto/bio/bss_log.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bio/bss_log.c b/src/lib/libcrypto/bio/bss_log.c index 5a79f72673..2d38837f9e 100644 --- a/src/lib/libcrypto/bio/bss_log.c +++ b/src/lib/libcrypto/bio/bss_log.c | |||
@@ -160,9 +160,7 @@ slg_write(BIO *b, const char *in, int inl) | |||
160 | if ((buf = (char *)OPENSSL_malloc(inl + 1)) == NULL) { | 160 | if ((buf = (char *)OPENSSL_malloc(inl + 1)) == NULL) { |
161 | return (0); | 161 | return (0); |
162 | } | 162 | } |
163 | strncpy(buf, in, inl); | 163 | strlcpy(buf, in, inl + 1); |
164 | buf[inl] = '\0'; | ||
165 | |||
166 | i = 0; | 164 | i = 0; |
167 | while (strncmp(buf, mapping[i].str, mapping[i].strl) != 0) | 165 | while (strncmp(buf, mapping[i].str, mapping[i].strl) != 0) |
168 | i++; | 166 | i++; |