diff options
| author | schwarze <> | 2018-04-01 00:36:28 +0000 |
|---|---|---|
| committer | schwarze <> | 2018-04-01 00:36:28 +0000 |
| commit | d00bb6331cc6c256da5ab5bbf5b24f1751ad367d (patch) | |
| tree | d68bda8b9354fb1fa31660be4c25fedb4487eef3 /src/lib/libcrypto/stack | |
| parent | fd23e46da856d00343d92965373b3cdb9875d6af (diff) | |
| download | openbsd-d00bb6331cc6c256da5ab5bbf5b24f1751ad367d.tar.gz openbsd-d00bb6331cc6c256da5ab5bbf5b24f1751ad367d.tar.bz2 openbsd-d00bb6331cc6c256da5ab5bbf5b24f1751ad367d.zip | |
When you replace an element in a sorted array with something
arbitrarily different, the array is in general no longer sorted.
This commit copies a small hidden bugfix from the OpenSSL commit
https://github.com/openssl/openssl/commit/fbb7b33b
the rest of which is merely cosmetics.
I discovered the bug independently while documenting sk_find(3).
Keep the library's idea of when an empty stack or a one-element stack
is sorted and when it is not bug-compatible with OpenSSL, even though
in fact, empty and one-element stacks are of course always sorted.
OK beck@
Diffstat (limited to '')
| -rw-r--r-- | src/lib/libcrypto/stack/stack.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/libcrypto/stack/stack.c b/src/lib/libcrypto/stack/stack.c index d941f9e6fb..b76a0d7271 100644 --- a/src/lib/libcrypto/stack/stack.c +++ b/src/lib/libcrypto/stack/stack.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: stack.c,v 1.19 2015/02/07 13:19:15 doug Exp $ */ | 1 | /* $OpenBSD: stack.c,v 1.20 2018/04/01 00:36:28 schwarze Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -312,6 +312,7 @@ sk_set(_STACK *st, int i, void *value) | |||
| 312 | { | 312 | { |
| 313 | if (!st || (i < 0) || (i >= st->num)) | 313 | if (!st || (i < 0) || (i >= st->num)) |
| 314 | return NULL; | 314 | return NULL; |
| 315 | st->sorted = 0; | ||
| 315 | return (st->data[i] = value); | 316 | return (st->data[i] = value); |
| 316 | } | 317 | } |
| 317 | 318 | ||
