From b40369b96d56a9f70072119f9d7a36a217391bcf Mon Sep 17 00:00:00 2001 From: Cameron Walters Date: Thu, 13 Jun 2024 12:38:14 -0700 Subject: [PATCH] fix(wiggle_abi): write the result's length, not the guest buffer's --- lib/src/wiggle_abi/device_detection_impl.rs | 2 +- lib/src/wiggle_abi/geo_impl.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/src/wiggle_abi/device_detection_impl.rs b/lib/src/wiggle_abi/device_detection_impl.rs index 7fbf8aa7..7587a9b4 100644 --- a/lib/src/wiggle_abi/device_detection_impl.rs +++ b/lib/src/wiggle_abi/device_detection_impl.rs @@ -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", diff --git a/lib/src/wiggle_abi/geo_impl.rs b/lib/src/wiggle_abi/geo_impl.rs index 906dcf25..5adc6bcc 100644 --- a/lib/src/wiggle_abi/geo_impl.rs +++ b/lib/src/wiggle_abi/geo_impl.rs @@ -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",