Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix possible uninitialised value dereference if jq_init() fails #2935

Merged
merged 1 commit into from
Oct 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ int umain(int argc, char* argv[]) {
int main(int argc, char* argv[]) {
#endif
jq_state *jq = NULL;
jq_util_input_state *input_state = NULL;
int ret = JQ_OK_NO_OUTPUT;
int compiled = 0;
int parser_flags = 0;
Expand All @@ -336,15 +337,15 @@ int main(int argc, char* argv[]) {

jq = jq_init();
if (jq == NULL) {
perror("malloc");
perror("jq_init");
ret = JQ_ERROR_SYSTEM;
goto out;
}

int dumpopts = JV_PRINT_INDENT_FLAGS(2);
const char* program = 0;

jq_util_input_state *input_state = jq_util_input_init(NULL, NULL); // XXX add err_cb
input_state = jq_util_input_init(NULL, NULL); // XXX add err_cb

int further_args_are_strings = 0;
int further_args_are_json = 0;
Expand Down