summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbeck <>2015-07-18 21:21:28 +0000
committerbeck <>2015-07-18 21:21:28 +0000
commitd0bf2476b7aa84b36b0f6d5173956b1dd3992566 (patch)
tree9ef952df47e94825ad141657cf179a92fc87879a /src
parent7f2d6dc6af99690299b2a423c25d0d7240957c6f (diff)
downloadopenbsd-d0bf2476b7aa84b36b0f6d5173956b1dd3992566.tar.gz
openbsd-d0bf2476b7aa84b36b0f6d5173956b1dd3992566.tar.bz2
openbsd-d0bf2476b7aa84b36b0f6d5173956b1dd3992566.zip
Coverity ID 78910 - Yet another stupid API designed to not show failures. do the
lease worst alternative and do nothing rather than dereference NULL, but having a function with fundamentally broken API to simply make a list of strings, sort them, and call a function with each string as an argument is really quite silly.... and of course it was exposed API that the ecosystem uses that we can't delete.. yet. ok miod@ doug@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/objects/o_names.c14
-rw-r--r--src/lib/libssl/src/crypto/objects/o_names.c14
2 files changed, 16 insertions, 12 deletions
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c
index e77e4a1093..81240db204 100644
--- a/src/lib/libcrypto/objects/o_names.c
+++ b/src/lib/libcrypto/objects/o_names.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: o_names.c,v 1.20 2015/02/10 11:22:21 jsing Exp $ */ 1/* $OpenBSD: o_names.c,v 1.21 2015/07/18 21:21:28 beck Exp $ */
2#include <stdio.h> 2#include <stdio.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <string.h> 4#include <string.h>
@@ -299,14 +299,16 @@ OBJ_NAME_do_all_sorted(int type, void (*fn)(const OBJ_NAME *, void *arg),
299 d.names = reallocarray(NULL, lh_OBJ_NAME_num_items(names_lh), 299 d.names = reallocarray(NULL, lh_OBJ_NAME_num_items(names_lh),
300 sizeof *d.names); 300 sizeof *d.names);
301 d.n = 0; 301 d.n = 0;
302 OBJ_NAME_do_all(type, do_all_sorted_fn, &d); 302 if (d.names != NULL) {
303 OBJ_NAME_do_all(type, do_all_sorted_fn, &d);
303 304
304 qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp); 305 qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp);
305 306
306 for (n = 0; n < d.n; ++n) 307 for (n = 0; n < d.n; ++n)
307 fn(d.names[n], arg); 308 fn(d.names[n], arg);
308 309
309 free((void *)d.names); 310 free(d.names);
311 }
310} 312}
311 313
312static int free_type; 314static int free_type;
diff --git a/src/lib/libssl/src/crypto/objects/o_names.c b/src/lib/libssl/src/crypto/objects/o_names.c
index e77e4a1093..81240db204 100644
--- a/src/lib/libssl/src/crypto/objects/o_names.c
+++ b/src/lib/libssl/src/crypto/objects/o_names.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: o_names.c,v 1.20 2015/02/10 11:22:21 jsing Exp $ */ 1/* $OpenBSD: o_names.c,v 1.21 2015/07/18 21:21:28 beck Exp $ */
2#include <stdio.h> 2#include <stdio.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <string.h> 4#include <string.h>
@@ -299,14 +299,16 @@ OBJ_NAME_do_all_sorted(int type, void (*fn)(const OBJ_NAME *, void *arg),
299 d.names = reallocarray(NULL, lh_OBJ_NAME_num_items(names_lh), 299 d.names = reallocarray(NULL, lh_OBJ_NAME_num_items(names_lh),
300 sizeof *d.names); 300 sizeof *d.names);
301 d.n = 0; 301 d.n = 0;
302 OBJ_NAME_do_all(type, do_all_sorted_fn, &d); 302 if (d.names != NULL) {
303 OBJ_NAME_do_all(type, do_all_sorted_fn, &d);
303 304
304 qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp); 305 qsort((void *)d.names, d.n, sizeof *d.names, do_all_sorted_cmp);
305 306
306 for (n = 0; n < d.n; ++n) 307 for (n = 0; n < d.n; ++n)
307 fn(d.names[n], arg); 308 fn(d.names[n], arg);
308 309
309 free((void *)d.names); 310 free(d.names);
311 }
310} 312}
311 313
312static int free_type; 314static int free_type;