diff options
author | Chung-yih Wang <cywang@google.com> | 2009-07-06 11:22:18 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-07-06 11:22:18 -0700 |
commit | 58c714c41ac3799b0b408affd9804056070d358c (patch) | |
tree | 24bed578ce9894c06b791261fce76e33451f4600 /cmds | |
parent | f6a6cff234e164874233de3618ab98b4fb00efb7 (diff) | |
parent | 699ca3f2518360ea3250ff5a0e5d39e122c64a91 (diff) | |
download | frameworks_base-58c714c41ac3799b0b408affd9804056070d358c.zip frameworks_base-58c714c41ac3799b0b408affd9804056070d358c.tar.gz frameworks_base-58c714c41ac3799b0b408affd9804056070d358c.tar.bz2 |
am 699ca3f2: Add password field for WiFi configuration.
Merge commit '699ca3f2518360ea3250ff5a0e5d39e122c64a91'
* commit '699ca3f2518360ea3250ff5a0e5d39e122c64a91':
Add password field for WiFi configuration.
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/keystore/certtool.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/cmds/keystore/certtool.h b/cmds/keystore/certtool.h index 7cd316b..aefad66 100644 --- a/cmds/keystore/certtool.h +++ b/cmds/keystore/certtool.h @@ -26,21 +26,29 @@ #include "common.h" #include "netkeystore.h" +#define CERT_NAME_LEN (2 * MAX_KEY_NAME_LENGTH + 2) + /* * The specific function 'get_cert' is used in daemons to get the key value * from keystore. Caller should allocate the buffer and the length of the buffer * should be MAX_KEY_VALUE_LENGTH. */ -static inline int get_cert(char *certname, unsigned char *value, int *size) +static inline int get_cert(const char *certname, unsigned char *value, int *size) { int count, fd, ret = -1; LPC_MARSHAL cmd; char delimiter[] = "_"; char *namespace, *keyname; char *context = NULL; + char cname[CERT_NAME_LEN]; + + if ((certname == NULL) || (value == NULL)) { + LOGE("get_cert: certname or value is null\n"); + return -1; + } - if (value == NULL) { - LOGE("get_cert: value is null\n"); + if (strlcpy(cname, certname, CERT_NAME_LEN) >= CERT_NAME_LEN) { + LOGE("get_cert: keyname is too long\n"); return -1; } @@ -53,7 +61,7 @@ static inline int get_cert(char *certname, unsigned char *value, int *size) } cmd.opcode = GET; - if (((namespace = strtok_r(certname, delimiter, &context)) == NULL) || + if (((namespace = strtok_r(cname, delimiter, &context)) == NULL) || ((keyname = strtok_r(NULL, delimiter, &context)) == NULL)) { goto err; } |