Author Topic: Bug in RakString.cpp  (Read 18489 times)

PeterYu

  • Not-a-newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Bug in RakString.cpp
« on: October 16, 2014, 02:36:55 AM »
When i test PHPDirectoryServer2 sample, found the bug.  In line 873:
Code: [Select]
char buff[3];
Itoa(c, buff, 16);
output[outputIndex++]='%';
output[outputIndex++]=buff[0];
output[outputIndex++]=buff[1];
When c less than 16(e.g. '\n'), buff[1] is 0, output be cut off. Should probably be:
Code: [Select]
char buff[3];
Itoa(c, buff, 16);
output[outputIndex++]='%';
if (c >= 16)
{
output[outputIndex++]=buff[0];
output[outputIndex++]=buff[1];
}
else
{
output[outputIndex++]='0';
output[outputIndex++]=buff[0];
}
« Last Edit: October 16, 2014, 03:19:01 AM by PeterYu »