fix null pointer dereference in setitimer time32 compat shim

this interface permits a null pointer for where to store the old
itimerval being replaced. an early version of the time32 compat shim
code had corresponding bugs for lots of functions; apparently
setitimer was overlooked when fixing them.
This commit is contained in:
Rich Felker 2019-12-08 10:35:04 -05:00
parent b1e2aae0aa
commit 9432bbd4e8
1 changed files with 6 additions and 4 deletions

View File

@ -15,9 +15,11 @@ int __setitimer_time32(int which, const struct itimerval32 *restrict new32, stru
* timer setting, so we can't fail on out-of-range old value.
* Since these are relative times, values large enough to overflow
* don't make sense anyway. */
if (old32) {
old32->it_interval.tv_sec = old.it_interval.tv_sec;
old32->it_interval.tv_usec = old.it_interval.tv_usec;
old32->it_value.tv_sec = old.it_value.tv_sec;
old32->it_value.tv_usec = old.it_value.tv_usec;
}
return 0;
}