aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/crypto.c2
-rw-r--r--src/common/torint.h4
2 files changed, 4 insertions, 2 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 2ef40c29c..8d17a3dae 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -523,7 +523,7 @@ crypto_pk_read_private_key_from_string(crypto_pk_env_t *env,
tor_assert(env);
tor_assert(s);
- tor_assert(len < INT_MAX && len < SIZE_T_CEILING);
+ tor_assert(len < INT_MAX && len < SSIZE_T_CEILING);
/* Create a read-only memory BIO, backed by the string 's' */
b = BIO_new_mem_buf((char*)s, (int)len);
diff --git a/src/common/torint.h b/src/common/torint.h
index f5bebf8b9..0b5c29adc 100644
--- a/src/common/torint.h
+++ b/src/common/torint.h
@@ -329,8 +329,10 @@ typedef uint32_t uintptr_t;
#endif
#endif
+/** Any ssize_t larger than this amount is likely to be an underflow. */
+#define SSIZE_T_CEILING ((ssize_t)(SSIZE_T_MAX-16))
/** Any size_t larger than this amount is likely to be an underflow. */
-#define SIZE_T_CEILING (SSIZE_T_MAX-16)
+#define SIZE_T_CEILING ((size_t)(SSIZE_T_MAX-16))
#endif /* __TORINT_H */