main: Use stronger error checking for client ids

pull/196/head
Andri Yngvason 2022-11-26 21:11:28 +00:00
parent 89bd6da3bb
commit c3c3e97794
1 changed files with 3 additions and 2 deletions

View File

@ -525,8 +525,9 @@ static int get_output_list(struct ctl* ctl,
static struct cmd_response* on_disconnect_client(struct ctl* ctl, static struct cmd_response* on_disconnect_client(struct ctl* ctl,
const char* id_string) const char* id_string)
{ {
int id = atoi(id_string); char* endptr;
if (id <= 0) unsigned int id = strtoul(id_string, &endptr, 0);
if (!*id_string || *endptr)
return cmd_failed("Invalid client ID \"%s\"", id_string); return cmd_failed("Invalid client ID \"%s\"", id_string);
struct wayvnc* self = ctl_server_userdata(ctl); struct wayvnc* self = ctl_server_userdata(ctl);