[AD] 4.9.2 buffer overflow?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


/4.9.2/src/win/wsystem.c

in function:

char *win_err_str(long err)
{
  static char msg[256];

  FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
                MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
                (LPTSTR)&msg, 0, NULL);

  return msg;
}


MSDN says that 2nd to last arg, '0' should be the length of the msg buffer in TCHARS. the above may have worked out of sheer luck, any message with >256 TCHARs has potential for overflow.




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/