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:
Eitan Adler 2018-05-23 09:16:20 +00:00
parent f3e32074e0
commit 6872fd3c94

View File

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