* 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

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