mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 03:23:04 +01:00
check for negative values before casting away. thanks, Alex
This commit is contained in:
parent
0d5a398cc3
commit
88dadd2403
@ -98,10 +98,14 @@ static int perf_format(const P* before, const P* after,
|
||||
*
|
||||
**************************************/
|
||||
SCHAR c;
|
||||
|
||||
SLONG buffer_length = buf_len ? *buf_len : 0;
|
||||
SCHAR* p = buffer;
|
||||
|
||||
if (buffer_length < 0)
|
||||
{
|
||||
buffer_length = 0;
|
||||
}
|
||||
|
||||
while ((c = *string++) && c != '$')
|
||||
{
|
||||
if (c != '!')
|
||||
@ -186,7 +190,7 @@ static int perf_format(const P* before, const P* after,
|
||||
}
|
||||
|
||||
*p = 0;
|
||||
const int length = p - buffer;
|
||||
const int length = static_cast<int>(p - buffer);
|
||||
if (buffer_length && (buffer_length -= length) >= 0) {
|
||||
memset(p, ' ', static_cast<size_t>(buffer_length));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user