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
1 changed files with 2 additions and 0 deletions

View File

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