summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Jacobs <kjacobs@mozilla.com>2019-09-24 21:50:31 +0000
committerKevin Jacobs <kjacobs@mozilla.com>2019-09-24 21:50:31 +0000
commitf65e7eb9ed787921fbd168d983111bdcb9baacf2 (patch)
tree37c835c0b9ef343666567f04f51a2037daeb769a
parent8fd862ae12eb7cc6076b9906193e305eed0c5d40 (diff)
downloadnss-hg-f65e7eb9ed787921fbd168d983111bdcb9baacf2.tar.gz
Bug 1581024 - fixup pointer wrap check to prevent it from being optimized out. r=jcj
Differential Revision: https://phabricator.services.mozilla.com/D47013
-rw-r--r--cmd/lib/derprint.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd/lib/derprint.c b/cmd/lib/derprint.c
index a7643be97..a22cf5460 100644
--- a/cmd/lib/derprint.c
+++ b/cmd/lib/derprint.c
@@ -509,7 +509,8 @@ prettyPrintItem(FILE *out, const unsigned char *data, const unsigned char *end,
/*
* Just quit now if slen more bytes puts us off the end.
*/
- if ((data + slen) < data || (data + slen) > end) {
+ if (((unsigned long)data + slen) < (unsigned long)data ||
+ ((unsigned long)data + slen) > (unsigned long)end) {
PORT_SetError(SEC_ERROR_BAD_DER);
return -1;
}