Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Hogan <doug@acyclic.org>2015-04-23 09:48:22 +0300
committerAdam Langley <agl@google.com>2015-04-25 02:19:56 +0300
commit41846c74f1668e95cb709e74db03f67a48d03c8c (patch)
tree3ee3d1cf4e8899762cdb10db268909cc9e9e3a6f /crypto/stack
parent9bc266e68d837178b56bc1c2893b01ccc812253a (diff)
Modify sk_find() so it returns 1 on success and 0 otherwise.
The 2 arg OpenSSL sk_find() returned -1 on error and >= 0 on success. BoringSSL's 3 arg sk_find() returns -1 if the sk argument is NULL, 0 if the item is not found, and 1 if found. In practice, all callers of the sk_find() macros in BoringSSL only check for zero/non-zero. If sk is ever NULL, it looks like most callers are going to use uninitialized data as the index because the return value check is insufficient. Change-Id: I640089a0f4044aaa8d50178b2aecd9c3c1fe2f9c Reviewed-on: https://boringssl-review.googlesource.com/4500 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/stack')
-rw-r--r--crypto/stack/stack.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c
index c8332de4..bc8c6f85 100644
--- a/crypto/stack/stack.c
+++ b/crypto/stack/stack.c
@@ -232,7 +232,7 @@ int sk_find(_STACK *sk, size_t *out_index, void *p) {
int (*comp_func)(const void *,const void *);
if (sk == NULL) {
- return -1;
+ return 0;
}
if (sk->comp == NULL) {