summaryrefslogtreecommitdiff
path: root/src/lib/libc/net/base64.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libc/net/base64.c')
-rw-r--r--src/lib/libc/net/base64.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/libc/net/base64.c b/src/lib/libc/net/base64.c
index d432c48d5c..78ef449a75 100644
--- a/src/lib/libc/net/base64.c
+++ b/src/lib/libc/net/base64.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: base64.c,v 1.5 2006/10/21 09:55:03 otto Exp $ */ 1/* $OpenBSD: base64.c,v 1.6 2013/11/24 23:51:28 deraadt Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 by Internet Software Consortium. 4 * Copyright (c) 1996 by Internet Software Consortium.
@@ -199,7 +199,7 @@ b64_pton(src, target, targsize)
199 state = 0; 199 state = 0;
200 tarindex = 0; 200 tarindex = 0;
201 201
202 while ((ch = *src++) != '\0') { 202 while ((ch = (unsigned char)*src++) != '\0') {
203 if (isspace(ch)) /* Skip whitespace anywhere. */ 203 if (isspace(ch)) /* Skip whitespace anywhere. */
204 continue; 204 continue;
205 205
@@ -258,8 +258,8 @@ b64_pton(src, target, targsize)
258 * on a byte boundary, and/or with erroneous trailing characters. 258 * on a byte boundary, and/or with erroneous trailing characters.
259 */ 259 */
260 260
261 if (ch == Pad64) { /* We got a pad char. */ 261 if (ch == Pad64) { /* We got a pad char. */
262 ch = *src++; /* Skip it, get next. */ 262 ch = (unsigned char)*src++; /* Skip it, get next. */
263 switch (state) { 263 switch (state) {
264 case 0: /* Invalid = in first position */ 264 case 0: /* Invalid = in first position */
265 case 1: /* Invalid = in second position */ 265 case 1: /* Invalid = in second position */
@@ -267,13 +267,13 @@ b64_pton(src, target, targsize)
267 267
268 case 2: /* Valid, means one byte of info */ 268 case 2: /* Valid, means one byte of info */
269 /* Skip any number of spaces. */ 269 /* Skip any number of spaces. */
270 for (; ch != '\0'; ch = *src++) 270 for (; ch != '\0'; ch = (unsigned char)*src++)
271 if (!isspace(ch)) 271 if (!isspace(ch))
272 break; 272 break;
273 /* Make sure there is another trailing = sign. */ 273 /* Make sure there is another trailing = sign. */
274 if (ch != Pad64) 274 if (ch != Pad64)
275 return (-1); 275 return (-1);
276 ch = *src++; /* Skip the = */ 276 ch = (unsigned char)*src++; /* Skip the = */
277 /* Fall through to "single trailing =" case. */ 277 /* Fall through to "single trailing =" case. */
278 /* FALLTHROUGH */ 278 /* FALLTHROUGH */
279 279
@@ -282,7 +282,7 @@ b64_pton(src, target, targsize)
282 * We know this char is an =. Is there anything but 282 * We know this char is an =. Is there anything but
283 * whitespace after it? 283 * whitespace after it?
284 */ 284 */
285 for (; ch != '\0'; ch = *src++) 285 for (; ch != '\0'; ch = (unsigned char)*src++)
286 if (!isspace(ch)) 286 if (!isspace(ch))
287 return (-1); 287 return (-1);
288 288