Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed Snyk vulnerabilities from bucket_metadata.c, request.c and serv…
…ice_access_logging.c file
  • Loading branch information
Iesan Remus committed Sep 9, 2025
commit a3d0f8ba215fd2fefa53c231dbeae5e8119f97e5
18 changes: 15 additions & 3 deletions src/bucket_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,11 @@ void S3_get_acl(const S3BucketContext *bucketContext, const char *key,
};

// Perform the request
request_perform(&params, requestContext);
if (!request_perform(&params, requestContext)) {
free(gaData);
(*(handler->completeCallback))(S3StatusRequestFailed, 0, callbackData);
return;
}
}


Expand Down Expand Up @@ -478,7 +482,11 @@ void S3_get_lifecycle(const S3BucketContext *bucketContext,
};

// Perform the request
request_perform(&params, requestContext);
if (!request_perform(&params, requestContext)) {
free(gaData);
(*(handler->completeCallback))(S3StatusRequestFailed, 0, callbackData);
return;
}
}


Expand Down Expand Up @@ -602,7 +610,11 @@ void S3_set_lifecycle(const S3BucketContext *bucketContext,
};

// Perform the request
request_perform(&params, requestContext);
if (!request_perform(&params, requestContext)) {
free(data);
(*(handler->completeCallback))(S3StatusRequestFailed, 0, callbackData);
return;
}
#endif
}

7 changes: 5 additions & 2 deletions src/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,10 @@ static void sort_query_string(const char *queryString, char *result,
// Where did strdup go?!??
int queryStringLen = strlen(queryString);
char *buf = (char *) malloc(queryStringLen + 1);
if (!buf) {
result[0] = '\0';
return; // <-- Add: free(buf); before return (but buf is NULL here, so it's safe)
}
char *tok = buf;
strcpy(tok, queryString);
const char *token = NULL;
Expand Down Expand Up @@ -865,9 +869,8 @@ static void sort_query_string(const char *queryString, char *result,
if (len > 0) {
result[len - 1] = 0;
}
#undef append

free(buf);
#undef append
}


Expand Down
11 changes: 7 additions & 4 deletions src/service_access_logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,16 @@ static S3Status convertBlsXmlCallback(const char *elementPath,

if (caData->emailAddress[0]) {
grant->granteeType = S3GranteeTypeAmazonCustomerByEmail;
strcpy(grant->grantee.amazonCustomerByEmail.emailAddress,
caData->emailAddress);
strncpy(grant->grantee.amazonCustomerByEmail.emailAddress, caData->emailAddress, S3_MAX_GRANTEE_EMAIL_ADDRESS_SIZE - 1);
grant->grantee.amazonCustomerByEmail.emailAddress[S3_MAX_GRANTEE_EMAIL_ADDRESS_SIZE - 1] = '\0';
}
else if (caData->userId[0] && caData->userDisplayName[0]) {
grant->granteeType = S3GranteeTypeCanonicalUser;
strcpy(grant->grantee.canonicalUser.id, caData->userId);
strcpy(grant->grantee.canonicalUser.displayName,
strncpy(grant->grantee.canonicalUser.id, caData->userId, S3_MAX_GRANTEE_USER_ID_SIZE - 1);
grant->grantee.canonicalUser.id[S3_MAX_GRANTEE_USER_ID_SIZE - 1] = '\0';

strncpy(grant->grantee.canonicalUser.displayName, caData->userDisplayName, S3_MAX_GRANTEE_DISPLAY_NAME_SIZE - 1);
grant->grantee.canonicalUser.displayName[S3_MAX_GRANTEE_DISPLAY_NAME_SIZE - 1] = '\0';
caData->userDisplayName);
}
else if (caData->groupUri[0]) {
Expand Down