Message ID | 20250303125724.54665-1-r.smirnov@omp.ru (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [BlueZ] client: add input validation to main() | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/BuildEll | success | Build ELL PASS |
tedd_an/BluezMake | success | Bluez Make PASS |
tedd_an/MakeCheck | success | Bluez Make Check PASS |
tedd_an/MakeDistcheck | success | Make Distcheck PASS |
tedd_an/CheckValgrind | success | Check Valgrind PASS |
tedd_an/CheckSmatch | success | CheckSparse PASS |
tedd_an/bluezmakeextell | success | Make External ELL PASS |
tedd_an/ScanBuild | success | Scan Build PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=939597 ---Test result--- Test Summary: CheckPatch PENDING 0.22 seconds GitLint PENDING 0.23 seconds BuildEll PASS 20.31 seconds BluezMake PASS 1412.58 seconds MakeCheck PASS 13.60 seconds MakeDistcheck PASS 158.13 seconds CheckValgrind PASS 213.66 seconds CheckSmatch PASS 281.94 seconds bluezmakeextell PASS 97.51 seconds IncrementalBuild PENDING 0.25 seconds ScanBuild PASS 855.08 seconds Details ############################## Test: CheckPatch - PENDING Desc: Run checkpatch.pl script Output: ############################## Test: GitLint - PENDING Desc: Run gitlint Output: ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth
diff --git a/client/main.c b/client/main.c index feb21a116..f3180a0fe 100644 --- a/client/main.c +++ b/client/main.c @@ -843,6 +843,17 @@ static gboolean parse_argument(int argc, char *argv[], const char **arg_table, return FALSE; } +static int validate_input(int argc, char *argv[]) { + for (int i = 0; i < argc; i++) { + if (!strisutf8(argv[i], strlen(argv[i]))) { + printf("Invalid character in string: %s\n", argv[i]); + return -EINVAL; + } + } + + return 0; +} + static void cmd_list(int argc, char *argv[]) { GList *list; @@ -3299,6 +3310,10 @@ int main(int argc, char *argv[]) int timeout; unsigned int timeout_id; + status = validate_input(argc, argv); + if (status) + return status; + bt_shell_init(argc, argv, &opt); bt_shell_set_menu(&main_menu); bt_shell_add_submenu(&advertise_menu);