Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/bucket.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ void S3_create_bucket(S3Protocol protocol, const char *accessKeyId,
};

// Perform the request
free(cbData);
request_perform(&params, requestContext);
}

Expand Down Expand Up @@ -411,6 +412,7 @@ void S3_delete_bucket(S3Protocol protocol, S3UriStyle uriStyle,
timeoutMs // timeoutMs
};

free(dbData);
// Perform the request
request_perform(&params, requestContext);
}
Expand Down
3 changes: 3 additions & 0 deletions src/bucket_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ void S3_get_acl(const S3BucketContext *bucketContext, const char *key,
timeoutMs // timeoutMs
};

free(gaData);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gaData is the callbackData which is passed into the perform-request logic.

Without any description of what is being fixed here I cannot suggest an alternative either.

// Perform the request
request_perform(&params, requestContext);
}
Expand Down Expand Up @@ -478,6 +479,7 @@ void S3_get_lifecycle(const S3BucketContext *bucketContext,
};

// Perform the request
free(gaData);
request_perform(&params, requestContext);
}

Expand Down Expand Up @@ -601,6 +603,7 @@ void S3_set_lifecycle(const S3BucketContext *bucketContext,
timeoutMs // timeoutMs
};

free(data);
// Perform the request
request_perform(&params, requestContext);
#endif
Expand Down
14 changes: 9 additions & 5 deletions src/general.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,14 +385,18 @@ static S3Status convertAclXmlCallback(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,
caData->userDisplayName);
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';
}
else if (caData->groupUri[0]) {
if (!strcmp(caData->groupUri,
Expand Down
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