var: Do not add 1 to return value of strchrnul
commitb4ecd84eb4048522648bc16920d3615cb243a6bf
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 3 Jan 2023 09:51:18 +0000 (3 17:51 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sun, 8 Jan 2023 12:03:08 +0000 (8 20:03 +0800)
tree43708b2832cf97e6526d15496ca9206d37a29895
parent44ae22beedf8a3d68bbfa1d065ad677182372de2
var: Do not add 1 to return value of strchrnul

When a variable like OPTIND is unset dash may call the action
function with a bogus pointer because it tries to add one to
the return value of strchrnul unconditionally.

Use strchr and nullstr instead.

Link: https://bugs.debian.org/985478
Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
src/var.c