Skip to content

Commit

Permalink
ra_key: handle error case (#5997)
Browse files Browse the repository at this point in the history
flb_sds_create_len may fail and this needs to be handled.

Fixes: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=46082

Signed-off-by: David Korczynski <[email protected]>
  • Loading branch information
DavidKorczynski authored Sep 5, 2022
1 parent 6a9c2b0 commit 80d0281
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/flb_ra_key.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ static int msgpack_object_to_ra_value(msgpack_object o,
result->type = FLB_RA_STRING;
result->val.string = flb_sds_create_len((char *) o.via.str.ptr,
o.via.str.size);

/* Handle cases where flb_sds_create_len fails */
if (result->val.string == NULL) {
return -1;
}
return 0;
}
else if (o.type == MSGPACK_OBJECT_MAP) {
Expand Down

0 comments on commit 80d0281

Please sign in to comment.