cut: Fix out of boundary write on illegal list argument

It is possible to trigger an out of boundary write in cut if an invalid
range with autostart has been supplied.

PR:		227330
Submitted by:	tobias@stoeckmann.org
This commit is contained in:
eadler 2018-05-23 09:16:20 +00:00
parent 68c7cdc07b
commit 37e8ba211c

View File

@ -210,6 +210,12 @@ get_list(char *list)
needpos(maxval + 1); needpos(maxval + 1);
} }
/* reversed range with autostart */
if (maxval < autostart) {
maxval = autostart;
needpos(maxval + 1);
}
/* set autostart */ /* set autostart */
if (autostart) if (autostart)
memset(positions + 1, '1', autostart); memset(positions + 1, '1', autostart);