diff options
| author | deraadt <> | 2014-05-29 21:07:43 +0000 |
|---|---|---|
| committer | deraadt <> | 2014-05-29 21:07:43 +0000 |
| commit | 642d45ae22413aa8195b105d051ca8896e782c5d (patch) | |
| tree | d5fe0c330801f3e72c7b588264c6027636db4330 /src/lib/libcrypto/objects/o_names.c | |
| parent | f60b3b3365842d8869513a7e36981671cd726939 (diff) | |
| download | openbsd-642d45ae22413aa8195b105d051ca8896e782c5d.tar.gz openbsd-642d45ae22413aa8195b105d051ca8896e782c5d.tar.bz2 openbsd-642d45ae22413aa8195b105d051ca8896e782c5d.zip | |
convert 53 malloc(a*b) to reallocarray(NULL, a, b). that is 53
potential integer overflows easily changed into an allocation return
of NULL, with errno nicely set if need be. checks for an allocations
returning NULL are commonplace, or if the object is dereferenced
(quite normal) will result in a nice fault which can be detected &
repaired properly.
ok tedu
Diffstat (limited to 'src/lib/libcrypto/objects/o_names.c')
| -rw-r--r-- | src/lib/libcrypto/objects/o_names.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c index 196d3ab0a7..169b8ae87d 100644 --- a/src/lib/libcrypto/objects/o_names.c +++ b/src/lib/libcrypto/objects/o_names.c | |||
| @@ -292,7 +292,8 @@ OBJ_NAME_do_all_sorted(int type, void (*fn)(const OBJ_NAME *, void *arg), | |||
| 292 | int n; | 292 | int n; |
| 293 | 293 | ||
| 294 | d.type = type; | 294 | d.type = type; |
| 295 | d.names = malloc(lh_OBJ_NAME_num_items(names_lh)*sizeof *d.names); | 295 | d.names = reallocarray(NULL, lh_OBJ_NAME_num_items(names_lh), |
| 296 | sizeof *d.names); | ||
| 296 | d.n = 0; | 297 | d.n = 0; |
| 297 | OBJ_NAME_do_all(type, do_all_sorted_fn, &d); | 298 | OBJ_NAME_do_all(type, do_all_sorted_fn, &d); |
| 298 | 299 | ||
