procd: check strchr() result before using it
authorJustinas Grauslis <justinas@8devices.com>
Mon, 8 Jul 2019 08:01:09 +0000 (11:01 +0300)
committerHans Dedecker <dedeckeh@gmail.com>
Sat, 13 Jul 2019 07:22:52 +0000 (09:22 +0200)
commit31f0765afd61f55b1dd2cdb62ec1968efca19690
tree22a41538ec3ab59bc54896ebf19078c1f62bba42
parentade00ca585a49c8478bf60eb24ce385676be37a4
procd: check strchr() result before using it

Subtracting some address from NULL does not necessary
results in negative value. It's lower level dependent.

In our case (IPQ4019 + Yocto + meta-openwrt) subtracting
token address from NULL strchr() return value results in
large positive number which causes out-of-boundary memory
access and eventually a segfault.

Signed-off-by: Justinas Grauslis <justinas@8devices.com>
utils/utils.c