Skip to content

Commit

Permalink
Merge pull request #437 from QRPp/fix-oob-nfs4_readlink_cb
Browse files Browse the repository at this point in the history
Fix out-of-bounds reading of v4 READLINK results
  • Loading branch information
sahlberg authored Feb 24, 2024
2 parents b7466b0 + 1918e4d commit 73640ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/nfs_v4.c
Original file line number Diff line number Diff line change
Expand Up @@ -2891,7 +2891,8 @@ nfs4_readlink_cb(struct rpc_context *rpc, int status, void *command_data,

rlresok = &res->resarray.resarray_val[i].nfs_resop4_u.opreadlink.READLINK4res_u.resok4;

target = strdup(rlresok->link.utf8string_val);
target = strndup(rlresok->link.utf8string_val,
rlresok->link.utf8string_len);
if (target == NULL) {
data->cb(-ENOMEM, nfs, "Failed to allocate memory",
data->private_data);
Expand Down

0 comments on commit 73640ed

Please sign in to comment.