Skip to content

Commit d8e4924

Browse files
estringanagleocadie
authored andcommitted
Add SSRF Rasp capability (#814)
1 parent 8331f61 commit d8e4924

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

profiling-ffi/src/exporter.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use ddcommon::tag::Tag;
1111
use ddcommon_ffi::slice::{AsBytes, ByteSlice, CharSlice, Slice};
1212
use ddcommon_ffi::{Error, MaybeError, Timespec};
1313
use std::borrow::Cow;
14+
use std::panic::{AssertUnwindSafe, catch_unwind};
1415
use std::ptr::NonNull;
1516
use std::str::FromStr;
1617

@@ -200,11 +201,16 @@ pub unsafe extern "C" fn ddog_prof_Exporter_set_timeout(
200201
exporter: Option<&mut ProfileExporter>,
201202
timeout_ms: u64,
202203
) -> MaybeError {
203-
if let Some(ptr) = exporter {
204-
ptr.set_timeout(timeout_ms);
205-
MaybeError::None
206-
} else {
207-
MaybeError::Some(Error::from("Invalid argument"))
204+
match catch_unwind(AssertUnwindSafe(|| {
205+
if let Some(ptr) = exporter {
206+
ptr.set_timeout(timeout_ms);
207+
MaybeError::None
208+
} else {
209+
MaybeError::Some(Error::from("Invalid argument"))
210+
}
211+
})) {
212+
Ok(r) => r,
213+
Err(_) => MaybeError::Some(Error::from("oops"))
208214
}
209215
}
210216

0 commit comments

Comments
 (0)