X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=crypt_common.c;h=022692adc52ce1cb8fe4ec925e93362e89b4b754;hp=6c71d7e3716829d90485894bc261ee867589d7bf;hb=9d8fdf8898418711558f70a9630b2444036d8285;hpb=282a5e463090205ef8a12f50a9ecf6498b860e88 diff --git a/crypt_common.c b/crypt_common.c index 6c71d7e3..022692ad 100644 --- a/crypt_common.c +++ b/crypt_common.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2013 Andre Noll + * Copyright (C) 2005 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -90,41 +90,31 @@ int base64_decode(char const *src, unsigned char *target, size_t targsize) switch (state) { case 0: - if (target) { - if (tarindex >= targsize) - return -E_BASE64; - target[tarindex] = (pos - Base64) << 2; - } + if (tarindex >= targsize) + return -E_BASE64; + target[tarindex] = (pos - Base64) << 2; state = 1; break; case 1: - if (target) { - if (tarindex + 1 >= targsize) - return -E_BASE64; - target[tarindex] |= (pos - Base64) >> 4; - target[tarindex+1] = ((pos - Base64) & 0x0f) - << 4 ; - } + if (tarindex + 1 >= targsize) + return -E_BASE64; + target[tarindex] |= (pos - Base64) >> 4; + target[tarindex + 1] = ((pos - Base64) & 0x0f) << 4; tarindex++; state = 2; break; case 2: - if (target) { - if (tarindex + 1 >= targsize) - return -E_BASE64; - target[tarindex] |= (pos - Base64) >> 2; - target[tarindex+1] = ((pos - Base64) & 0x03) - << 6; - } + if (tarindex + 1 >= targsize) + return -E_BASE64; + target[tarindex] |= (pos - Base64) >> 2; + target[tarindex + 1] = ((pos - Base64) & 0x03) << 6; tarindex++; state = 3; break; case 3: - if (target) { - if (tarindex >= targsize) - return -E_BASE64; - target[tarindex] |= (pos - Base64); - } + if (tarindex >= targsize) + return -E_BASE64; + target[tarindex] |= pos - Base64; tarindex++; state = 0; break; @@ -170,7 +160,7 @@ int base64_decode(char const *src, unsigned char *target, size_t targsize) * zeros. If we don't check them, they become a * subliminal channel. */ - if (target && target[tarindex] != 0) + if (target[tarindex] != 0) return -E_BASE64; } } else {