if (*s == ' ')
{
// Space is encoded as '+'
- *bufptr++ = '+';
+ if (bufptr < bufend)
+ *bufptr++ = '+';
+ else
+ bufptr ++;
}
else if (*s == '\n')
{
// Newline is encoded as percent-encoded CR & LF
- *bufptr++ = '%';
+ if (bufptr < bufend)
+ *bufptr++ = '%';
+ else
+ bufptr ++;
if (bufptr < bufend)
*bufptr++ = '0';
else
else if (!isalnum(*s & 255))
{
// Characters other than letters and numbers get percent-encoded
- *bufptr++ = '%';
+ if (bufptr < bufend)
+ *bufptr++ = '%';
+ else
+ bufptr ++;
if (bufptr < bufend)
*bufptr++ = hex[(*s >> 4) & 15];
else