diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2023-01-27 20:47:24 +0100 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2023-01-28 15:14:22 +0100 |
commit | c07cf691adb4740759e9fd128a2f6702c912d70f (patch) | |
tree | 91520d9be1270aae41d23ffeae1f69d3a31b10d2 /src/plugins/script | |
parent | c9ac4fef4b7aa054df72bddf667edea0608d39c6 (diff) | |
download | weechat-c07cf691adb4740759e9fd128a2f6702c912d70f.zip |
core, plugins: check that string parameters are not NULL in search functions (issue #1872)
Diffstat (limited to 'src/plugins/script')
-rw-r--r-- | src/plugins/script/script-repo.c | 6 | ||||
-rw-r--r-- | src/plugins/script/script.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/plugins/script/script-repo.c b/src/plugins/script/script-repo.c index df947e098..43376a9fa 100644 --- a/src/plugins/script/script-repo.c +++ b/src/plugins/script/script-repo.c @@ -122,6 +122,9 @@ script_repo_search_by_name (const char *name) { struct t_script_repo *ptr_script; + if (!name) + return NULL; + for (ptr_script = scripts_repo; ptr_script; ptr_script = ptr_script->next_script) { @@ -144,6 +147,9 @@ script_repo_search_by_name_ext (const char *name_with_extension) { struct t_script_repo *ptr_script; + if (!name_with_extension) + return NULL; + for (ptr_script = scripts_repo; ptr_script; ptr_script = ptr_script->next_script) { diff --git a/src/plugins/script/script.c b/src/plugins/script/script.c index 16481c0d4..553ac3765 100644 --- a/src/plugins/script/script.c +++ b/src/plugins/script/script.c @@ -67,6 +67,9 @@ script_language_search (const char *language) { int i; + if (!language) + return -1; + for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++) { if (strcmp (script_language[i], language) == 0) @@ -88,6 +91,9 @@ script_language_search_by_extension (const char *extension) { int i; + if (!extension) + return -1; + for (i = 0; i < SCRIPT_NUM_LANGUAGES; i++) { if (strcmp (script_extension[i], extension) == 0) |