mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-29 01:03:57 +03:00
options: Fix null ptr deference introduced in earlier fix.
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
7fef6e817e
commit
fadbe80c43
@@ -1017,6 +1017,13 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv) {
|
|||||||
} /* switch */
|
} /* switch */
|
||||||
} /* while */
|
} /* while */
|
||||||
opterr = saveopterr;
|
opterr = saveopterr;
|
||||||
|
tmp = realloc(save, (current + (argc - optind)) * sizeof(char*));
|
||||||
|
if (tmp == NULL) {
|
||||||
|
SAFE_FREE(save);
|
||||||
|
ssh_set_error_oom(session);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
save = tmp;
|
||||||
while (optind < argc) {
|
while (optind < argc) {
|
||||||
tmp = realloc(save, (current + 1) * sizeof(char*));
|
tmp = realloc(save, (current + 1) * sizeof(char*));
|
||||||
if (tmp == NULL) {
|
if (tmp == NULL) {
|
||||||
|
|||||||
Reference in New Issue
Block a user