summaryrefslogtreecommitdiffstats
path: root/imap
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2022-04-09 13:32:33 -0700
committerKevin McCarthy <kevin@8t8.us>2022-04-12 11:07:34 -0700
commitf82641352c6c0f1912c518875133a9b73a0e1f34 (patch)
tree9261b92befb8c51cb8be4665fe14293baa0ab457 /imap
parent195bcad02535738e03788e34cdc3f1f0c842b6e1 (diff)
Fix strlen() assigns to be of type size_t where obvious.
Ticket 405 had an almost-exploit enabled by sloppy assignment of strlen(). There were more details involved, of course, but this served as encouragement to clean up obvious "strlen assignment to int" in the rest of the code. Note this is not *all* cases, only those that were simple and obvious. In some cases, the code assigns strlen() to an int but also uses that variable to hold negative values for another reason. In other cases, an API is involved (e.g. SASL) that make changing potentially dangerous. And lastly, some functions were just a bit too complicated to risk introducing a bug.
Diffstat (limited to 'imap')
-rw-r--r--imap/auth_cram.c2
-rw-r--r--imap/imap.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/imap/auth_cram.c b/imap/auth_cram.c
index f27ef5dc..6080ea47 100644
--- a/imap/auth_cram.c
+++ b/imap/auth_cram.c
@@ -138,7 +138,7 @@ static void hmac_md5 (const char* password, char* challenge,
unsigned char ipad[MD5_BLOCK_LEN], opad[MD5_BLOCK_LEN];
unsigned char secret[MD5_BLOCK_LEN+1];
unsigned char hash_passwd[MD5_DIGEST_LEN];
- unsigned int secret_len, chal_len;
+ size_t secret_len, chal_len;
int i;
secret_len = strlen (password);
diff --git a/imap/imap.c b/imap/imap.c
index 43011e26..445cff2e 100644
--- a/imap/imap.c
+++ b/imap/imap.c
@@ -2396,7 +2396,7 @@ int imap_complete(char* dest, size_t dlen, const char* path)
char buf[LONG_STRING*2];
IMAP_LIST listresp;
char completion[LONG_STRING];
- int clen;
+ size_t clen;
size_t matchlen = 0;
int completions = 0;
IMAP_MBOX mx;