diff options
author | tedu <> | 2014-04-19 15:19:20 +0000 |
---|---|---|
committer | tedu <> | 2014-04-19 15:19:20 +0000 |
commit | 8418b729d0db4b3f3bd967c66f2d998ac4fe9580 (patch) | |
tree | 93a79da8e336a2fc4cec1f2098e5fad004b2042f /src | |
parent | 502d0dcab1eadeb81a1474e4c5c12d8e0254eb2c (diff) | |
download | openbsd-8418b729d0db4b3f3bd967c66f2d998ac4fe9580.tar.gz openbsd-8418b729d0db4b3f3bd967c66f2d998ac4fe9580.tar.bz2 openbsd-8418b729d0db4b3f3bd967c66f2d998ac4fe9580.zip |
one small tweak to avoid ever going off the end of a string.
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libc/crypt/bcrypt.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libc/crypt/bcrypt.c b/src/lib/libc/crypt/bcrypt.c index a077c99de5..7fcb2a5187 100644 --- a/src/lib/libc/crypt/bcrypt.c +++ b/src/lib/libc/crypt/bcrypt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bcrypt.c,v 1.38 2014/04/19 15:17:59 tedu Exp $ */ | 1 | /* $OpenBSD: bcrypt.c,v 1.39 2014/04/19 15:19:20 tedu Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 4 | * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
@@ -276,10 +276,12 @@ decode_base64(u_int8_t *buffer, size_t len, const char *b64data) | |||
276 | 276 | ||
277 | while (bp < buffer + len) { | 277 | while (bp < buffer + len) { |
278 | c1 = CHAR64(*p); | 278 | c1 = CHAR64(*p); |
279 | c2 = CHAR64(*(p + 1)); | ||
280 | |||
281 | /* Invalid data */ | 279 | /* Invalid data */ |
282 | if (c1 == 255 || c2 == 255) | 280 | if (c1 == 255) |
281 | return -1; | ||
282 | |||
283 | c2 = CHAR64(*(p + 1)); | ||
284 | if (c2 == 255) | ||
283 | return -1; | 285 | return -1; |
284 | 286 | ||
285 | *bp++ = (c1 << 2) | ((c2 & 0x30) >> 4); | 287 | *bp++ = (c1 << 2) | ((c2 & 0x30) >> 4); |