Skip to content

Commit

Permalink
fix(wiggle_abi): write the result's length, not the guest buffer's
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-dub committed Jun 13, 2024
1 parent e95fbbf commit b40369b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/src/wiggle_abi/device_detection_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl FastlyDeviceDetection for Session {
};

if result.len() > buf_len as usize {
nwritten_out.write(buf_len)?;
nwritten_out.write(result.len())?;
return Err(Error::BufferLengthError {
buf: "device_detection_lookup",
len: "device_detection_lookup_max_len",
Expand Down
2 changes: 1 addition & 1 deletion lib/src/wiggle_abi/geo_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl FastlyGeo for Session {
let result = self.geolocation_lookup(&ip_addr).unwrap_or_default();

if result.len() > buf_len as usize {
nwritten_out.write(buf_len)?;
nwritten_out.write(result.len())?;
return Err(Error::BufferLengthError {
buf: "geolocation_lookup",
len: "geolocation_lookup_max_len",
Expand Down

0 comments on commit b40369b

Please sign in to comment.