git.samba.org
/
metze
/
samba-autobuild
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9fd3939
)
lib/texpect: avoid theoretical NULL dereference (CID 1273099)
author
Douglas Bagnall
<douglas.bagnall@catalyst.net.nz>
Fri, 3 May 2019 04:15:30 +0000
(16:15 +1200)
committer
Douglas Bagnall
<dbagnall@samba.org>
Thu, 9 May 2019 22:39:27 +0000
(22:39 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
lib/texpect/texpect.c
patch
|
blob
|
history
diff --git
a/lib/texpect/texpect.c
b/lib/texpect/texpect.c
index 3f6278bbb10595e8cc76e83dd5432d45bcff8737..8ced5638c674c347581c4581ecbdbd0dbfcd2bef 100644
(file)
--- a/
lib/texpect/texpect.c
+++ b/
lib/texpect/texpect.c
@@
-424,6
+424,11
@@
int main(int argc, const char **argv)
instruction_file = poptGetArg(pc);
args = poptGetArgs(pc);
+ if (args == NULL) {
+ poptPrintHelp(pc, stderr, 0);
+ return 1;
+ }
+
program_args = (char * const *)discard_const_p(char *, args);
program = program_args[0];
@@
-432,7
+437,7
@@
int main(int argc, const char **argv)
printf("Using instruction_file: %s\n", instruction_file);
printf("Executing '%s' ", program);
- for (i = 0; program_args
&& program_args
[i] != NULL; i++) {
+ for (i = 0; program_args[i] != NULL; i++) {
printf("'%s' ", program_args[i]);
}
printf("\n");