mirror of
https://github.com/cc65/cc65.git
synced 2025-01-03 01:31:55 +00:00
Abort on string overflow
git-svn-id: svn://svn.cc65.org/cc65/trunk@21 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
2d99d910b2
commit
58a9481d8d
@ -65,14 +65,14 @@ int xvsprintf (char* Buf, size_t BufSize, const char* Format, va_list ap)
|
|||||||
/* Replacement function for sprintf */
|
/* Replacement function for sprintf */
|
||||||
{
|
{
|
||||||
#if defined(__WATCOMC__)
|
#if defined(__WATCOMC__)
|
||||||
return _vbprintf (Buf, BufSize, Format, ap);
|
int Res = _vbprintf (Buf, BufSize, Format, ap);
|
||||||
#elsif defined(__GNUC__)
|
#elsif defined(__GNUC__)
|
||||||
return vsnprintf (Buf, BufSize, Format, ap);
|
int Res = vsnprintf (Buf, BufSize, Format, ap);
|
||||||
#else
|
#else
|
||||||
int Res = vsprintf (Buf, Format, ap);
|
int Res = vsprintf (Buf, Format, ap);
|
||||||
assert ((unsigned) Res < BufSize);
|
|
||||||
return Res;
|
|
||||||
#endif
|
#endif
|
||||||
|
assert (Res >= 0 && (unsigned) Res < BufSize);
|
||||||
|
return Res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user