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/x509/by_dir.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/x509/by_dir.c')
-rw-r--r-- | src/lib/libcrypto/x509/by_dir.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/lib/libcrypto/x509/by_dir.c b/src/lib/libcrypto/x509/by_dir.c index b5512895a1..ccf2f6e0bf 100644 --- a/src/lib/libcrypto/x509/by_dir.c +++ b/src/lib/libcrypto/x509/by_dir.c | |||
@@ -246,13 +246,11 @@ add_cert_dir(BY_DIR *ctx, const char *dir, int type) | |||
246 | return 0; | 246 | return 0; |
247 | ent->dir_type = type; | 247 | ent->dir_type = type; |
248 | ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); | 248 | ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); |
249 | ent->dir = OPENSSL_malloc((unsigned int)len + 1); | 249 | ent->dir = strdup(ss); |
250 | if (!ent->dir || !ent->hashes) { | 250 | if (!ent->dir || !ent->hashes) { |
251 | by_dir_entry_free(ent); | 251 | by_dir_entry_free(ent); |
252 | return 0; | 252 | return 0; |
253 | } | 253 | } |
254 | strncpy(ent->dir, ss,(unsigned int)len); | ||
255 | ent->dir[len] = '\0'; | ||
256 | if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { | 254 | if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { |
257 | by_dir_entry_free(ent); | 255 | by_dir_entry_free(ent); |
258 | return 0; | 256 | return 0; |