mirror of
git://git.gnupg.org/gnupg.git
synced 2024-11-04 20:38:50 +01:00
Protect error counter against overflow.
* util/logger.c (log_inc_errorcount): Protect against overflow. (g10_log_warning): Bumb error counter using the above function. (g10_log_error): Ditto. -- This is a similar patch we use in 2.2 and libgpg-error. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
f32dbf396a
commit
c8ad567e7c
@ -109,6 +109,8 @@ log_get_errorcount( int clear)
|
|||||||
void
|
void
|
||||||
log_inc_errorcount()
|
log_inc_errorcount()
|
||||||
{
|
{
|
||||||
|
/* Protect agains overflow. */
|
||||||
|
if (errorcount < 30000)
|
||||||
errorcount++;
|
errorcount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +181,7 @@ g10_log_warning( const char *fmt, ... )
|
|||||||
|
|
||||||
if(strict)
|
if(strict)
|
||||||
{
|
{
|
||||||
errorcount++;
|
log_inc_errorcount ();
|
||||||
g10_log_print_prefix(_("ERROR: "));
|
g10_log_print_prefix(_("ERROR: "));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -203,7 +205,7 @@ g10_log_error( const char *fmt, ... )
|
|||||||
va_start( arg_ptr, fmt ) ;
|
va_start( arg_ptr, fmt ) ;
|
||||||
vfprintf(logfp,fmt,arg_ptr) ;
|
vfprintf(logfp,fmt,arg_ptr) ;
|
||||||
va_end(arg_ptr);
|
va_end(arg_ptr);
|
||||||
errorcount++;
|
log_inc_errorcount ();
|
||||||
#ifdef __riscos__
|
#ifdef __riscos__
|
||||||
fflush( logfp );
|
fflush( logfp );
|
||||||
#endif /* __riscos__ */
|
#endif /* __riscos__ */
|
||||||
@ -285,6 +287,3 @@ g10_log_hexdump( const char *text, const char *buf, size_t len )
|
|||||||
fflush( logfp );
|
fflush( logfp );
|
||||||
#endif /* __riscos__ */
|
#endif /* __riscos__ */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user