To figure out if we're going outside the buffer, use the size of the buffer,

not the size of the integer used to index in said buffer.

PR: 794
Notified by: Rhett Garber <rhett_garber@hp.com>
This commit is contained in:
Richard Levitte 2003-12-11 18:01:03 +00:00
parent 4775944f81
commit a2b0de98af

View File

@ -652,8 +652,8 @@ fmtfp(
(caps ? "0123456789ABCDEF" (caps ? "0123456789ABCDEF"
: "0123456789abcdef")[intpart % 10]; : "0123456789abcdef")[intpart % 10];
intpart = (intpart / 10); intpart = (intpart / 10);
} while (intpart && (iplace < (int)sizeof(iplace))); } while (intpart && (iplace < (int)sizeof(iconvert)));
if (iplace == sizeof iplace) if (iplace == sizeof iconvert)
iplace--; iplace--;
iconvert[iplace] = 0; iconvert[iplace] = 0;
@ -664,7 +664,7 @@ fmtfp(
: "0123456789abcdef")[fracpart % 10]; : "0123456789abcdef")[fracpart % 10];
fracpart = (fracpart / 10); fracpart = (fracpart / 10);
} while (fplace < max); } while (fplace < max);
if (fplace == sizeof fplace) if (fplace == sizeof fconvert)
fplace--; fplace--;
fconvert[fplace] = 0; fconvert[fplace] = 0;