Skip to content

Commit

Permalink
uri: not allow negative pos
Browse files Browse the repository at this point in the history
Signed-off-by: Takahiro Yamashita <[email protected]>
  • Loading branch information
nokute78 committed Sep 17, 2023
1 parent 55ce8a5 commit de00c08
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/flb_uri.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ flb_sds_t flb_uri_encode(const char *uri, size_t len)
/* Retrieve a given field based on it expected position in the URI */
struct flb_uri_field *flb_uri_get(struct flb_uri *uri, int pos)
{
if (pos < 0) {
flb_trace("[uri] negative pos");
return NULL;
}

if (pos >= FLB_URI_MAX || pos > uri->count) {
flb_trace("[uri] requested position > FLB_URI_MAX");
return NULL;
Expand Down

0 comments on commit de00c08

Please sign in to comment.