mirror of
https://gitee.com/openharmony/security_certificate_manager
synced 2024-11-27 01:30:33 +00:00
commit
84405ef58d
@ -478,6 +478,7 @@ static int32_t CheckIsAuthorizedApp(const struct CMUri *uriObj)
|
||||
uint32_t clientUid = 0;
|
||||
if (CmIsNumeric(uriObj->clientApp, strlen(uriObj->clientApp) + 1, &clientUid) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
CM_FREE_PTR(macByte.data);
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
@ -232,6 +232,7 @@ static int32_t CheckAndGetStore(const struct CmContext *context, const struct Cm
|
||||
uint32_t userId = 0;
|
||||
if (CmIsNumeric(uriObj.user, strlen(uriObj.user) + 1, &userId) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
(void)CertManagerFreeUri(&uriObj);
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@ -731,6 +732,7 @@ static int32_t CmComparisonCallerIdWithUri(const struct CmContext *context,
|
||||
uint32_t userId = 0;
|
||||
if (CmIsNumeric(uriObj.user, strlen(uriObj.user) + 1, &userId) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
(void)CertManagerFreeUri(&uriObj);
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
@ -742,6 +744,7 @@ static int32_t CmComparisonCallerIdWithUri(const struct CmContext *context,
|
||||
uint32_t uid = 0;
|
||||
if (CmIsNumeric(uriObj.app, strlen(uriObj.app) + 1, &uid) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
(void)CertManagerFreeUri(&uriObj);
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,8 @@ int32_t CmConstructContextFromUri(const char *certUri, struct CmContext *context
|
||||
if (CmIsNumeric(cmUri.user, strlen(cmUri.user) + 1, &(context->userId)) != CM_SUCCESS ||
|
||||
CmIsNumeric(cmUri.app, strlen(cmUri.app) + 1, &(context->uid)) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
ret = CMR_ERROR_INVALID_ARGUMENT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (snprintf_s(context->packageName, sizeof(context->packageName), sizeof(context->packageName) - 1, "%s",
|
||||
@ -404,7 +405,7 @@ static int32_t UpdateUserCerts(uint32_t userId, const char *userIdPath)
|
||||
/* Update certificate file */
|
||||
if (CmIsNumeric(dire->d_name, strlen(dire->d_name) + 1, &uid) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = UpdateUserCert(userId, uid, (const char *)certFilePath->data);
|
||||
@ -455,7 +456,7 @@ static int32_t UpdateAllUserCerts(void)
|
||||
/* Updates all certificates for the specified user */
|
||||
if (CmIsNumeric(dire->d_name, strlen(dire->d_name) + 1, &userId) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t ret = UpdateUserCerts(userId, userIdPath);
|
||||
|
@ -552,6 +552,7 @@ int32_t CertManagerGetUidFromUri(const struct CmBlob *uri, uint32_t *uid)
|
||||
|
||||
if (CmIsNumeric(uriObj.app, strlen(uriObj.app) + 1, uid) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
(void)CertManagerFreeUri(&uriObj);
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
@ -321,6 +321,7 @@ static int32_t CmTraversalDir(const struct CmContext *context, const char *path,
|
||||
|
||||
if (CmIsNumeric(dire->d_name, strlen(dire->d_name) + 1, &uid) != CM_SUCCESS) {
|
||||
CM_LOG_E("parse string to uint32 failed.");
|
||||
closedir(dir);
|
||||
return CMR_ERROR_INVALID_ARGUMENT;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user