diff options
author | Martin Willi <martin@revosec.ch> | 2012-10-24 10:54:04 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2012-10-24 13:07:53 +0200 |
commit | 4ce55ffb0b193d2082a408a11361345431ded946 (patch) | |
tree | 849c9e35762cb11da2ae33dac42be65159371c74 | |
parent | cd844e1c97be895e2169caf959f38d2c52acc46c (diff) | |
download | strongswan-4ce55ffb0b193d2082a408a11361345431ded946.tar.bz2 strongswan-4ce55ffb0b193d2082a408a11361345431ded946.tar.xz |
Use explicit, larger buffer sizes for smartcard keyids and modules
-rw-r--r-- | src/libcharon/plugins/stroke/stroke_cred.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/libcharon/plugins/stroke/stroke_cred.c b/src/libcharon/plugins/stroke/stroke_cred.c index c872ea9fd..de80327e4 100644 --- a/src/libcharon/plugins/stroke/stroke_cred.c +++ b/src/libcharon/plugins/stroke/stroke_cred.c @@ -96,16 +96,16 @@ typedef enum { * Parse a smartcard specifier token */ static smartcard_format_t parse_smartcard(char *smartcard, u_int *slot, - char module[BUF_LEN], char keyid[BUF_LEN]) + char module[128], char keyid[128]) { /* The token has one of the following three formats: * - %smartcard<slot>@<module>:<keyid> * - %smartcard<slot>:<keyid> * - %smartcard:<keyid> */ - char buf[BUF_LEN], *pos; + char buf[256], *pos; - if (sscanf(smartcard, "%%smartcard%u@%127s", slot, buf) == 2) + if (sscanf(smartcard, "%%smartcard%u@%255s", slot, buf) == 2) { pos = strchr(buf, ':'); if (!pos) @@ -117,11 +117,11 @@ static smartcard_format_t parse_smartcard(char *smartcard, u_int *slot, snprintf(keyid, BUF_LEN, "%s", pos); return SC_FORMAT_SLOT_MODULE_KEYID; } - if (sscanf(smartcard, "%%smartcard%u:%63s", slot, keyid) == 2) + if (sscanf(smartcard, "%%smartcard%u:%127s", slot, keyid) == 2) { return SC_FORMAT_SLOT_KEYID; } - if (sscanf(smartcard, "%%smartcard:%63s", keyid) == 1) + if (sscanf(smartcard, "%%smartcard:%127s", keyid) == 1) { return SC_FORMAT_KEYID; } @@ -174,7 +174,7 @@ METHOD(stroke_cred_t, load_ca, certificate_t*, if (strneq(filename, "%smartcard", strlen("%smartcard"))) { smartcard_format_t format; - char module[BUF_LEN], keyid[BUF_LEN]; + char module[128], keyid[128]; u_int slot; format = parse_smartcard(filename, &slot, module, keyid); @@ -238,7 +238,7 @@ METHOD(stroke_cred_t, load_peer, certificate_t*, if (strneq(filename, "%smartcard", strlen("%smartcard"))) { smartcard_format_t format; - char module[BUF_LEN], keyid[BUF_LEN]; + char module[128], keyid[128]; u_int slot; format = parse_smartcard(filename, &slot, module, keyid); @@ -702,7 +702,7 @@ static bool load_pin(private_stroke_cred_t *this, chunk_t line, int line_nr, FILE *prompt) { chunk_t sc = chunk_empty, secret = chunk_empty; - char smartcard[BUF_LEN], keyid[BUF_LEN], module[BUF_LEN]; + char smartcard[256], keyid[128], module[128]; private_key_t *key = NULL; u_int slot; chunk_t chunk; |