]> git.ipfire.org Git - thirdparty/shadow.git/commit
chage: Prevent signed integer overflows. 267/head
authorTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 12 Jul 2020 15:56:38 +0000 (17:56 +0200)
committerTobias Stoeckmann <tobias@stoeckmann.org>
Sun, 12 Jul 2020 15:56:38 +0000 (17:56 +0200)
commit83aa88466d1beef5e594a1520063c8e76a7c5f15
tree01b0c5d3ed79283c6b380f2c6f9bd1cbd3331abc
parent607f1dd549cf9abc87af1cf29275f0d2d11eea29
chage: Prevent signed integer overflows.

This is merely a stability fix, not a security fix.

As the root user, it is possible to set time values which later on
result in signed integer overflows.

For this to work, an sgetspent implementation must be used which
supports long values (glibc on amd64 only parses 32 bit, not 64).
Either use musl or simply call configure with following environment
variable:

$ ac_cv_func_sgetspent=no ./configure

Also it is recommended to compile with -fsanitize=undefined or
-ftrapv to see these issues easily.

Examples to trigger issues when calling "chage -l user":

$ chage -d 9223372036854775807 user

$ chage -d 106751991167300 user
$ chage -M 9999 user

$ chage -d 90000000000000 user
$ chage -I 90000000000000 user
$ chage -M 9999 user

$ chage -E 9223372036854775807 user

While at it, I fixed casting issues which could lead to signed integer
overflows on systems which still have a 32 bit time_t.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
src/chage.c