@@ -1418,7 +1418,13 @@ sentry_capture_minidump_n(const char *path, size_t path_len)
14181418void
14191419sentry_add_attachment (const char * path )
14201420{
1421- sentry_path_t * attachment = sentry__path_from_str (path );
1421+ sentry_add_attachment_n (path , sentry__guarded_strlen (path ));
1422+ }
1423+
1424+ void
1425+ sentry_add_attachment_n (const char * path , size_t path_len )
1426+ {
1427+ sentry_path_t * attachment = sentry__path_from_str_n (path , path_len );
14221428 SENTRY_WITH_OPTIONS (options ) {
14231429 if (options -> backend && options -> backend -> add_attachment_func ) {
14241430 options -> backend -> add_attachment_func (options -> backend , attachment );
@@ -1433,7 +1439,13 @@ sentry_add_attachment(const char *path)
14331439void
14341440sentry_remove_attachment (const char * path )
14351441{
1436- sentry_path_t * attachment = sentry__path_from_str (path );
1442+ sentry_remove_attachment_n (path , sentry__guarded_strlen (path ));
1443+ }
1444+
1445+ void
1446+ sentry_remove_attachment_n (const char * path , size_t path_len )
1447+ {
1448+ sentry_path_t * attachment = sentry__path_from_str_n (path , path_len );
14371449 SENTRY_WITH_OPTIONS (options ) {
14381450 if (options -> backend && options -> backend -> remove_attachment_func ) {
14391451 options -> backend -> remove_attachment_func (
@@ -1449,7 +1461,14 @@ sentry_remove_attachment(const char *path)
14491461void
14501462sentry_add_attachmentw (const wchar_t * path )
14511463{
1452- sentry_path_t * attachment = sentry__path_from_wstr (path );
1464+ size_t path_len = path ? wcslen (path ) : 0 ;
1465+ sentry_add_attachmentw_n (path , path_len );
1466+ }
1467+
1468+ void
1469+ sentry_add_attachmentw_n (const wchar_t * path , size_t path_len )
1470+ {
1471+ sentry_path_t * attachment = sentry__path_from_wstr_n (path , path_len );
14531472 SENTRY_WITH_OPTIONS (options ) {
14541473 if (options -> backend && options -> backend -> add_attachment_func ) {
14551474 options -> backend -> add_attachment_func (options -> backend , attachment );
@@ -1464,7 +1483,14 @@ sentry_add_attachmentw(const wchar_t *path)
14641483void
14651484sentry_remove_attachmentw (const wchar_t * path )
14661485{
1467- sentry_path_t * attachment = sentry__path_from_wstr (path );
1486+ size_t path_len = path ? wcslen (path ) : 0 ;
1487+ sentry_remove_attachmentw_n (path , path_len );
1488+ }
1489+
1490+ void
1491+ sentry_remove_attachmentw_n (const wchar_t * path , size_t path_len )
1492+ {
1493+ sentry_path_t * attachment = sentry__path_from_wstr_n (path , path_len );
14681494 SENTRY_WITH_OPTIONS (options ) {
14691495 if (options -> backend && options -> backend -> remove_attachment_func ) {
14701496 options -> backend -> remove_attachment_func (
0 commit comments