Skip to content

Commit

Permalink
Add SSRF Rasp capability (#814)
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana authored and gleocadie committed Jan 6, 2025
1 parent 8331f61 commit d8e4924
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions profiling-ffi/src/exporter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use ddcommon::tag::Tag;
use ddcommon_ffi::slice::{AsBytes, ByteSlice, CharSlice, Slice};
use ddcommon_ffi::{Error, MaybeError, Timespec};
use std::borrow::Cow;
use std::panic::{AssertUnwindSafe, catch_unwind};
use std::ptr::NonNull;
use std::str::FromStr;

Expand Down Expand Up @@ -200,11 +201,16 @@ pub unsafe extern "C" fn ddog_prof_Exporter_set_timeout(
exporter: Option<&mut ProfileExporter>,
timeout_ms: u64,
) -> MaybeError {
if let Some(ptr) = exporter {
ptr.set_timeout(timeout_ms);
MaybeError::None
} else {
MaybeError::Some(Error::from("Invalid argument"))
match catch_unwind(AssertUnwindSafe(|| {
if let Some(ptr) = exporter {
ptr.set_timeout(timeout_ms);
MaybeError::None
} else {
MaybeError::Some(Error::from("Invalid argument"))
}
})) {
Ok(r) => r,
Err(_) => MaybeError::Some(Error::from("oops"))
}
}

Expand Down

0 comments on commit d8e4924

Please sign in to comment.