* syscalls.cc (utmp_data): Fix potential buffer overflow.

This commit is contained in:
Corinna Vinschen 2011-01-31 13:58:59 +00:00
parent adef8606bd
commit 2daa7e07ce
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2011-01-31 Corinna Vinschen <corinna@vinschen.de>
* syscalls.cc (utmp_data): Fix potential buffer overflow.
2011-01-31 Corinna Vinschen <corinna@vinschen.de> 2011-01-31 Corinna Vinschen <corinna@vinschen.de>
* fhandler_socket.cc (address_in_use): Improve comment readability. * fhandler_socket.cc (address_in_use): Improve comment readability.

View File

@ -3508,7 +3508,7 @@ static struct utmp utmp_data_buf[16];
static unsigned utix = 0; static unsigned utix = 0;
#define nutdbuf (sizeof (utmp_data_buf) / sizeof (utmp_data_buf[0])) #define nutdbuf (sizeof (utmp_data_buf) / sizeof (utmp_data_buf[0]))
#define utmp_data ({ \ #define utmp_data ({ \
if (utix > nutdbuf) \ if (utix >= nutdbuf) \
utix = 0; \ utix = 0; \
utmp_data_buf + utix++; \ utmp_data_buf + utix++; \
}) })