Fix a potentially non-returning function in base64 code.

This commit is contained in:
Colin Guthrie 2009-01-13 23:34:09 +00:00
parent f3101133d7
commit df564040b5

View file

@ -45,6 +45,7 @@ static int pos(char c)
if (c >= '0' && c <= '9') return c - '0' + 52; if (c >= '0' && c <= '9') return c - '0' + 52;
if (c == '+') return 62; if (c == '+') return 62;
if (c == '/') return 63; if (c == '/') return 63;
return -1;
} }
int pa_base64_encode(const void *data, int size, char **str) int pa_base64_encode(const void *data, int size, char **str)
@ -97,8 +98,12 @@ static unsigned int token_decode(const char *token)
marker++; marker++;
else if (marker > 0) else if (marker > 0)
return DECODE_ERROR; return DECODE_ERROR;
else else {
val += pos(token[i]); int lpos = pos(token[i]);
if (lpos < 0)
return DECODE_ERROR;
val += lpos;
}
} }
if (marker > 2) if (marker > 2)
return DECODE_ERROR; return DECODE_ERROR;