diff options
author | Mattias Andrée <maandree@member.fsf.org> | 2015-12-26 15:04:39 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@member.fsf.org> | 2015-12-26 15:04:39 +0100 |
commit | 2bcaff7589c7fe0816bb5f08b500fdc942c13d89 (patch) | |
tree | f97484715ac8ded22edbbad28aeaf84bf0c4d4b5 /src/satr.c | |
parent | create socket (diff) | |
download | sat-2bcaff7589c7fe0816bb5f08b500fdc942c13d89.tar.gz sat-2bcaff7589c7fe0816bb5f08b500fdc942c13d89.tar.bz2 sat-2bcaff7589c7fe0816bb5f08b500fdc942c13d89.tar.xz |
marshalled arrays are not empty-element-terminated
Signed-off-by: Mattias Andrée <maandree@member.fsf.org>
Diffstat (limited to '')
-rw-r--r-- | src/satr.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -63,16 +63,18 @@ main(int argc, char *argv[]) char *msg = NULL; int i; - if (argc > 0) argv0 = argv[0]; + if (argc > 0) + argv0 = argv[0]; if (argc < 2) goto run; - if (!strcmp(argv[1], "--") + if (!strcmp(argv[1], "--")) argv++, argc--; for (i = 1; i < argc; i++) if (argv[i][0] == '-') usage(); - if (!(msg = malloc(n = measure_array(argv + 1)))) + n = measure_array(argv + 1); + if (n ? !(msg = malloc(n)) : 0) goto fail; store_array(msg, argv + 1); |