diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-08-24 00:16:31 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-08-24 00:16:31 +0200 |
commit | 3053e2430a134d82979a92a1578fbd97613c663f (patch) | |
tree | 22a2ad9e91e79aa76677618e84e5c2b7e8f70d83 | |
parent | add install and uninstall rules (diff) | |
download | setpgrp-3053e2430a134d82979a92a1578fbd97613c663f.tar.gz setpgrp-3053e2430a134d82979a92a1578fbd97613c663f.tar.bz2 setpgrp-3053e2430a134d82979a92a1578fbd97613c663f.tar.xz |
m fix
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/setpgrp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/setpgrp.c b/src/setpgrp.c index 976b10f..0f76ea9 100644 --- a/src/setpgrp.c +++ b/src/setpgrp.c @@ -61,12 +61,12 @@ int main(int argc, char* argv[]) goto fail; group = getpgrp(); - args = malloc((size_t)argc * sizeof(char*)); + args = malloc((size_t)(argc - off + 1) * sizeof(char*)); if (args == NULL) goto fail; memcpy(args, argv + off, (size_t)(argc - off) * sizeof(char*)); - args[argc - 1] = NULL; + args[argc - off] = NULL; if (switch_print) if (printf("%ji\n", (intmax_t)group) < 0) |