mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
common: Also protect log_inc_errorcount against counter overflow.
* common/logging.c (log_inc_errorcount): Also protect against overflow. (log_error): Call log_inc_errorcount instead of directly bumping the counter. -- We already had an overflow checking for log_error but not for the silent increment function. This is basically the same fix we have in libgpg-error (libgpg-error commit d72c1ddfde09ffa69745ec2439c5a16d15e2202f) Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
c1d716cd65
commit
47f514fde6
@ -129,6 +129,8 @@ log_get_errorcount (int clear)
|
|||||||
void
|
void
|
||||||
log_inc_errorcount (void)
|
log_inc_errorcount (void)
|
||||||
{
|
{
|
||||||
|
/* Protect against counter overflow. */
|
||||||
|
if (errorcount < 30000)
|
||||||
errorcount++;
|
errorcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,9 +934,7 @@ log_error (const char *fmt, ...)
|
|||||||
va_start (arg_ptr, fmt);
|
va_start (arg_ptr, fmt);
|
||||||
do_logv (GPGRT_LOG_ERROR, 0, NULL, NULL, fmt, arg_ptr);
|
do_logv (GPGRT_LOG_ERROR, 0, NULL, NULL, fmt, arg_ptr);
|
||||||
va_end (arg_ptr);
|
va_end (arg_ptr);
|
||||||
/* Protect against counter overflow. */
|
log_inc_errorcount ();
|
||||||
if (errorcount < 30000)
|
|
||||||
errorcount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user