summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bio/bss_log.c
diff options
context:
space:
mode:
authorbeck <>2014-04-16 20:36:35 +0000
committerbeck <>2014-04-16 20:36:35 +0000
commit750d86a4fc04f53024575d65269281ea6c4e450c (patch)
tree4a8d2bd6f2dd786d658a75ea2db858806f2ec5f4 /src/lib/libcrypto/bio/bss_log.c
parentbe77aa550ef0450b00eb62880d4d98112ba86e50 (diff)
downloadopenbsd-750d86a4fc04f53024575d65269281ea6c4e450c.tar.gz
openbsd-750d86a4fc04f53024575d65269281ea6c4e450c.tar.bz2
openbsd-750d86a4fc04f53024575d65269281ea6c4e450c.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.c4
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++;