chown: fix out-of-bounds ((null) bad address error)

Signed-off-by: Hiltjo Posthuma <hiltjo@codemadness.org>
This commit is contained in:
Hiltjo Posthuma 2014-04-18 19:46:02 +02:00 committed by sin
parent 1d5663672e
commit cd194d96ad

View File

@ -32,11 +32,13 @@ main(int argc, char *argv[])
default: default:
usage(); usage();
} ARGEND; } ARGEND;
if(argc == 0) if(argc == 0)
usage(); usage();
owner = argv[0]; owner = argv[0];
argv++; argv++;
argc--;
if((group = strchr(owner, ':'))) if((group = strchr(owner, ':')))
*group++ = '\0'; *group++ = '\0';