aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Andree <matthias.andree@gmx.de>2004-06-19 01:44:56 +0000
committerMatthias Andree <matthias.andree@gmx.de>2004-06-19 01:44:56 +0000
commit67d5e1e4ca79d86c8beedc8709efb27f83295443 (patch)
treeb8692dc1d527a427787e86e6e1f02f14a5203630
parentad03539e8bf64c9e3393f357857c5c751d682abc (diff)
downloadfetchmail-67d5e1e4ca79d86c8beedc8709efb27f83295443.tar.gz
fetchmail-67d5e1e4ca79d86c8beedc8709efb27f83295443.tar.bz2
fetchmail-67d5e1e4ca79d86c8beedc8709efb27f83295443.zip
Cast arguments of is*() ctype.h functions to unsigned char to be 8-bit safe.
svn path=/trunk/; revision=3903
-rw-r--r--env.c2
-rw-r--r--imap.c16
-rw-r--r--netrc.c6
-rw-r--r--pop3.c2
-rw-r--r--sink.c8
-rw-r--r--smbencrypt.c4
-rw-r--r--socket.c6
-rw-r--r--transact.c22
-rw-r--r--unmime.c6
9 files changed, 36 insertions, 36 deletions
diff --git a/env.c b/env.c
index 6b6a7d07..ae658bcd 100644
--- a/env.c
+++ b/env.c
@@ -279,7 +279,7 @@ char *visbuf(const char *buf)
*tp++ = '\\'; *tp++ = '\\';
buf++;
}
- else if (isprint(*buf) || *buf == ' ')
+ else if (isprint((unsigned char)*buf) || *buf == ' ')
*tp++ = *buf++;
else if (*buf == '\n')
{
diff --git a/imap.c b/imap.c
index d7f0b83f..f1b516ee 100644
--- a/imap.c
+++ b/imap.c
@@ -53,8 +53,8 @@ static int imap_ok(int sock, char *argbuf)
/* all tokens in responses are caseblind */
for (cp = buf; *cp; cp++)
- if (islower(*cp))
- *cp = toupper(*cp);
+ if (islower((unsigned char)*cp))
+ *cp = toupper((unsigned char)*cp);
/* interpret untagged status responses */
if (strstr(buf, "* CAPABILITY"))
@@ -137,9 +137,9 @@ static int imap_ok(int sock, char *argbuf)
char *cp;
/* skip the tag */
- for (cp = buf; !isspace(*cp); cp++)
+ for (cp = buf; !isspace((unsigned char)*cp); cp++)
continue;
- while (isspace(*cp))
+ while (isspace((unsigned char)*cp))
cp++;
if (strncasecmp(cp, "OK", 2) == 0)
@@ -747,7 +747,7 @@ static int imap_getrange(int sock,
while (*cp && unseen < count)
{
/* skip whitespace */
- while (*cp && isspace(*cp))
+ while (*cp && isspace((unsigned char)*cp))
cp++;
if (*cp)
{
@@ -894,9 +894,9 @@ static int imap_is_old(int sock, struct query *ctl, int number)
static char *skip_token(char *ptr)
{
- while(isspace(*ptr)) ptr++;
- while(!isspace(*ptr) && !iscntrl(*ptr)) ptr++;
- while(isspace(*ptr)) ptr++;
+ while(isspace((unsigned char)*ptr)) ptr++;
+ while(!isspace((unsigned char)*ptr) && !iscntrl((unsigned char)*ptr)) ptr++;
+ while(isspace((unsigned char)*ptr)) ptr++;
return(ptr);
}
diff --git a/netrc.c b/netrc.c
index a9e29741..03c6e5be 100644
--- a/netrc.c
+++ b/netrc.c
@@ -107,7 +107,7 @@ parse_netrc (file)
ln++;
/* Strip trailing CRLF */
- for (p = buf + strlen(buf) - 1; (p >= buf) && isspace(*p); p--)
+ for (p = buf + strlen(buf) - 1; (p >= buf) && isspace((unsigned char)*p); p--)
*p = '\0';
/* Parse the line. */
@@ -129,7 +129,7 @@ parse_netrc (file)
char *pp;
/* Skip any whitespace. */
- while (*p && isspace (*p))
+ while (*p && isspace ((unsigned char)*p))
p++;
/* Discard end-of-line comments. */
@@ -139,7 +139,7 @@ parse_netrc (file)
tok = pp = p;
/* Find the end of the token. */
- while (*p && (quote_char || !isspace (*p)))
+ while (*p && (quote_char || !isspace ((unsigned char)*p)))
{
if (quote_char)
{
diff --git a/pop3.c b/pop3.c
index fc574f64..1a74715a 100644
--- a/pop3.c
+++ b/pop3.c
@@ -148,7 +148,7 @@ static int pop3_ok (int sock, char *argbuf)
else
return(PS_PROTOCOL);
- while (isalpha(*bufp))
+ while (isalpha((unsigned char)*bufp))
bufp++;
if (*bufp)
diff --git a/sink.c b/sink.c
index cf79a0f7..c8c8fd9f 100644
--- a/sink.c
+++ b/sink.c
@@ -402,9 +402,9 @@ static int send_bouncemail(struct query *ctl, struct msgblk *msg,
/* errors correspond 1-1 to selected users */
error = errors[nusers++];
- if (strlen(error) > 9 && isdigit(error[4])
- && error[5] == '.' && isdigit(error[6])
- && error[7] == '.' && isdigit(error[8]))
+ if (strlen(error) > 9 && isdigit((unsigned char)error[4])
+ && error[5] == '.' && isdigit((unsigned char)error[6])
+ && error[7] == '.' && isdigit((unsigned char)error[8]))
/* Enhanced status code available, use it */
SockPrintf(sock, "Status: %5.5s\r\n", &(error[4]));
else
@@ -781,7 +781,7 @@ static const char *is_quad(const char *q)
return NULL;
if (*q == '.')
q++;
- for(r=q;isdigit(*r);r++)
+ for(r=q;isdigit((unsigned char)*r);r++)
;
if ( ((*r) && (*r != '.')) || ((r-q) < 1) || ((r-q)>3) )
return NULL;
diff --git a/smbencrypt.c b/smbencrypt.c
index 8740481d..144911b3 100644
--- a/smbencrypt.c
+++ b/smbencrypt.c
@@ -108,8 +108,8 @@ while (*s)
s += skip;
else
{
- if (islower(*s))
- *s = toupper(*s);
+ if (islower((unsigned char)*s))
+ *s = toupper((unsigned char)*s);
s++;
}
}
diff --git a/socket.c b/socket.c
index 108f2e30..b8195e5f 100644
--- a/socket.c
+++ b/socket.c
@@ -90,7 +90,7 @@ static char *const *parse_plugin(const char *plugin, const char *host, const cha
unsigned int service_len = strlen(service);
for (c = p = plugin; *c; c++)
- { if (isspace(*c) && !isspace(*p))
+ { if (isspace((unsigned char)*c) && !isspace((unsigned char)*p))
s += sizeof(char*);
if (*p == '%' && *c == 'h')
host_count++;
@@ -134,14 +134,14 @@ static char *const *parse_plugin(const char *plugin, const char *host, const cha
}
memset(argvec, 0, s);
for (c = p = plugin_copy, i = 0; *c; c++)
- { if ((!isspace(*c)) && (c == p ? 1 : isspace(*p))) {
+ { if ((!isspace((unsigned char)*c)) && (c == p ? 1 : isspace((unsigned char)*p))) {
argvec[i] = c;
i++;
}
p = c;
}
for (cp = plugin_copy; *cp; cp++)
- { if (isspace(*cp))
+ { if (isspace((unsigned char)*cp))
*cp = 0;
}
return (char *const*)argvec;
diff --git a/transact.c b/transact.c
index c65b8ba4..e6020821 100644
--- a/transact.c
+++ b/transact.c
@@ -207,17 +207,17 @@ static char *parse_received(struct query *ctl, char *bufp)
{
if (!(ok = strstr(base, "by")))
break;
- else if (!isspace(ok[-1]) || !isspace(ok[2]))
+ else if (!isspace((unsigned char)ok[-1]) || !isspace((unsigned char)ok[2]))
continue;
else
{
char *sp, *tp;
/* extract space-delimited token after "by" */
- for (sp = ok + 2; isspace(*sp); sp++)
+ for (sp = ok + 2; isspace((unsigned char)*sp); sp++)
continue;
tp = rbuf;
- for (; !isspace(*sp); sp++)
+ for (; !isspace((unsigned char)*sp); sp++)
RBUF_WRITE(*sp);
*tp = '\0';
@@ -255,17 +255,17 @@ static char *parse_received(struct query *ctl, char *bufp)
{
if (!(ok = strstr(base, "for")))
break;
- else if (!isspace(ok[-1]) || !isspace(ok[3]))
+ else if (!isspace((unsigned char)ok[-1]) || !isspace((unsigned char)ok[3]))
continue;
else
{
char *sp, *tp;
/* extract space-delimited token after "for" */
- for (sp = ok + 3; isspace(*sp); sp++)
+ for (sp = ok + 3; isspace((unsigned char)*sp); sp++)
continue;
tp = rbuf;
- for (; !isspace(*sp); sp++)
+ for (; !isspace((unsigned char)*sp); sp++)
RBUF_WRITE(*sp);
*tp = '\0';
@@ -281,7 +281,7 @@ static char *parse_received(struct query *ctl, char *bufp)
char *sp, *tp;
/* char after "for" could be space or a continuation newline */
- for (sp = ok + 4; isspace(*sp); sp++)
+ for (sp = ok + 4; isspace((unsigned char)*sp); sp++)
continue;
tp = rbuf;
RBUF_WRITE(':'); /* Here is the hack. This is to be friends */
@@ -295,9 +295,9 @@ static char *parse_received(struct query *ctl, char *bufp)
while (*sp && *sp++ != ':')
continue;
while (*sp
- && (want_gt ? (*sp != '>') : !isspace(*sp))
+ && (want_gt ? (*sp != '>') : !isspace((unsigned char)*sp))
&& *sp != ';')
- if (!isspace(*sp))
+ if (!isspace((unsigned char)*sp))
{
RBUF_WRITE(*sp);
sp++;
@@ -543,7 +543,7 @@ int readheaders(int sock,
* line before the body! Without this check fetchmail segfaults.
* With it, we treat such messages as spam and refuse them.
*/
- if (!refuse_mail && !isspace(line[0]) && !strchr(line, ':'))
+ if (!refuse_mail && !isspace((unsigned char)line[0]) && !strchr(line, ':'))
{
if (linelen != strlen (line))
has_nuls = TRUE;
@@ -696,7 +696,7 @@ int readheaders(int sock,
else
cp = NULL;
if (cp) {
- while (*cp && isspace(*cp)) cp++;
+ while (*cp && isspace((unsigned char)*cp)) cp++;
if (!*cp || ctl->dropstatus)
{
free(line);
diff --git a/unmime.c b/unmime.c
index 65f654a8..ad402aa8 100644
--- a/unmime.c
+++ b/unmime.c
@@ -291,7 +291,7 @@ static char *GetBoundary(char *CntType)
do {
p2 = strchr(p1, ';');
if (p2)
- for (p2++; isspace(*p2); p2++);
+ for (p2++; isspace((unsigned char)*p2); p2++);
p1 = p2;
} while ((p1) && (strncasecmp(p1, "boundary", 8) != 0));
@@ -301,7 +301,7 @@ static char *GetBoundary(char *CntType)
return NULL;
/* Skip "boundary", whitespace and '='; check that we do have a '=' */
- for (p1+=8, flag=0; (isspace(*p1) || (*p1 == '=')); p1++)
+ for (p1+=8, flag=0; (isspace((unsigned char)*p1) || (*p1 == '=')); p1++)
flag |= (*p1 == '=');
if (!flag)
return NULL;
@@ -349,7 +349,7 @@ static int CheckContentType(char *CntType)
if (CntType == NULL) return 0;
/* Skip whitespace, if any */
- for (; isspace(*p); p++) ;
+ for (; isspace((unsigned char)*p); p++) ;
for (i=0;
(DecodedTypes[i] &&