Limit the number of clients to return to the number of clients to avoid possible overflows for very large N and add N=0 as special option to return all clients (even if the user does not know how many there are)
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
aa123cacde
commit
fa6a8b38e9
|
@ -199,7 +199,7 @@ components:
|
|||
clients:
|
||||
N:
|
||||
in: query
|
||||
description: Maximum number of clients to return
|
||||
description: Maximum number of clients to return, setting this to 0 will return all clients
|
||||
name: N
|
||||
schema:
|
||||
type: integer
|
||||
|
|
|
@ -73,6 +73,12 @@ int api_history_clients(struct ftl_conn *api)
|
|||
{
|
||||
// Does the user request a non-default number of clients
|
||||
get_uint_var(api->request->query_string, "N", &Nc);
|
||||
|
||||
// Limit the number of clients to return to the number of
|
||||
// clients to avoid possible overflows for very large N
|
||||
// Also allow N=0 to return all clients
|
||||
if((int)Nc > counters->clients || Nc == 0)
|
||||
Nc = counters->clients;
|
||||
}
|
||||
|
||||
// Lock shared memory
|
||||
|
|
Loading…
Reference in New Issue