It worked. Thanks.
- Original Message -
From: Mayhem & Chaos Coordinator <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 08, 1999 3:35 PM
Subject: ParseColor -- potential problem
> I think I may have found a potential problem in ParseColor. I cannot
> currently check the mods in -- I'm in the middle of doing a ton of other
> things. However, try replacing the function in Theme.cpp with this
function:
>
> Error Theme::ParseColor(string &oColorstring, Color &oColor)
> {
> int iRet;
> int iRed, iGreen, iBlue;
>
> iRet = sscanf(oColorstring.c_str(), "#%02X%02X%02X",
> &iRed, &iGreen, &iBlue);
>
> if (iRet == 3)
> {
> oColor.red = iRed;
> oColor.green = iGreen;
> oColor.blue = iBlue;
> return kError_NoErr;
> }
>
> return kError_InvalidParam;
> }
>
> I think that passing 3 unsigned chars to sscanf when parsing a %X may not
be
> valid and result in two bytes on the heap getting trashed. This rev of the
> function passes three int and then manually converts them over after the
> scanf. I'll check this code in later on in any case, just to be sure.
>
> Let me know if this helps.
>
> --ruaok Freezerburn! All else is only icing. -- Soul Coughing
>
> Robert Kaye -- [EMAIL PROTECTED] http://moon.eorbit.net/~robert
>
>