bug 210109 : fix crash due to misaligned address (use PRUintn for '%2X' in PR_sscanf instead of char) r=wtc, sr=darin

This commit is contained in:
jshin%mailaps.org 2003-06-26 23:53:26 +00:00
parent ee91f53156
commit 9ac6ce9f32

View File

@ -463,13 +463,14 @@ char *DecodeQ(const char *in, PRUint32 length)
if (dest == nsnull)
return nsnull;
while (length > 0) {
PRUintn c = 0;
switch (*in) {
case '=':
// check if |in| in the form of '=hh' where h is [0-9a-fA-F].
if (length < 3 || !ISHEXCHAR(in[1]) || !ISHEXCHAR(in[2]))
goto badsyntax;
PR_sscanf(in + 1, "%2X", out);
++out;
PR_sscanf(in + 1, "%2X", &c);
*out++ = (char) c;
in += 3;
length -= 3;
break;