nightmaremail

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 9aba4fcedcb5005df99354261f0a427808a8f2d6
parent e4fa409afaf82ba7e3beab24cbb1bb6268ca7604
Author: Rolf Eike Beer <eike@sf-mail.de>
Date:   Thu, 14 May 2020 20:40:58 +0200

use unsigned variables in qmail-pop3d

Diffstat:
Mqmail-pop3d.c | 13+++++++------
1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/qmail-pop3d.c b/qmail-pop3d.c @@ -1,5 +1,6 @@ #include <sys/types.h> #include <sys/stat.h> +#include <limits.h> #include <stdlib.h> #include <unistd.h> #include "commands.h" @@ -126,7 +127,7 @@ struct message { unsigned long size; char *fn; } *m; -int numm; +unsigned int numm; int last = 0; @@ -134,7 +135,7 @@ void getlist() { struct prioq_elt pe; struct stat st; - int i; + unsigned int i; maildir_clean(&line); if (maildir_scan(&pq,&filenames,1,1) == -1) die_scan(); @@ -157,7 +158,7 @@ void getlist() void pop3_stat(arg) char *arg; { - int i; + unsigned int i; unsigned long total; total = 0; @@ -172,7 +173,7 @@ void pop3_stat(arg) char *arg; void pop3_rset(arg) char *arg; { - int i; + unsigned int i; for (i = 0;i < numm;++i) m[i].flagdeleted = 0; last = 0; okay(0); @@ -188,7 +189,7 @@ void pop3_last(arg) char *arg; void pop3_quit(arg) char *arg; { - int i; + unsigned int i; for (i = 0;i < numm;++i) if (m[i].flagdeleted) { if (unlink(m[i].fn) == -1) err_nounlink(); @@ -211,7 +212,7 @@ int msgno(arg) char *arg; if (!scan_ulong(arg,&u)) { err_syntax(); return -1; } if (!u) { err_nozero(); return -1; } --u; - if (u >= numm) { err_toobig(); return -1; } + if (u >= numm || u >= INT_MAX) { err_toobig(); return -1; } if (m[u].flagdeleted) { err_deleted(); return -1; } return u; }