Skip to content

Commit

Permalink
integrity: add validity checks for 'path' parameter
Browse files Browse the repository at this point in the history
This patch adds validity checks for 'path' parameter and
makes it const.

Signed-off-by: Dmitry Kasatkin <d.kasatkin@samsung.com>
Signed-off-by: Mimi Zohar <zohar@linux.vnet.ibm.com>
  • Loading branch information
Dmitry Kasatkin authored and Mimi Zohar committed May 21, 2015
1 parent f2b3dee commit 9d03a72
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion security/integrity/digsig.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int __init integrity_init_keyring(const unsigned int id)
return err;
}

int __init integrity_load_x509(const unsigned int id, char *path)
int __init integrity_load_x509(const unsigned int id, const char *path)
{
key_ref_t key;
char *data;
Expand Down
3 changes: 3 additions & 0 deletions security/integrity/iint.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ int __init integrity_read_file(const char *path, char **data)
char *buf;
int rc = -EINVAL;

if (!path || !*path)
return -EINVAL;

file = filp_open(path, O_RDONLY, 0);
if (IS_ERR(file)) {
rc = PTR_ERR(file);
Expand Down
2 changes: 1 addition & 1 deletion security/integrity/integrity.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ int integrity_digsig_verify(const unsigned int id, const char *sig, int siglen,
const char *digest, int digestlen);

int __init integrity_init_keyring(const unsigned int id);
int __init integrity_load_x509(const unsigned int id, char *path);
int __init integrity_load_x509(const unsigned int id, const char *path);
#else

static inline int integrity_digsig_verify(const unsigned int id,
Expand Down

0 comments on commit 9d03a72

Please sign in to comment.