diff options
author | Werner Koch <wk@gnupg.org> | 2017-01-02 13:29:18 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2017-01-02 13:29:18 +0100 |
commit | 6b84ecbf312d98ac8cce9fe5facdc815bc742fa1 (patch) | |
tree | a607006cafbc14a6d52a054ee1a2b5d77f435d5c /scd | |
parent | build: Enable gcc warnings to detect non-portable code. (diff) | |
download | gnupg2-6b84ecbf312d98ac8cce9fe5facdc815bc742fa1.tar.xz gnupg2-6b84ecbf312d98ac8cce9fe5facdc815bc742fa1.zip |
Replace use of variable-length-arrays.
* common/t-iobuf.c (main): Replace variable-length-array.
* g10/gpgcompose.c (mksubpkt_callback): Ditto.
(encrypted): Ditto.
* g10/t-stutter.c (log_hexdump): Ditto.
(oracle_test): Ditto.
* g10/tofu.c (get_policy): Ditto. Use "%zu" for size_t.
* scd/app-openpgp.c (ecc_writekey): Replace variable-length-array.
Check for zero length OID_LEN.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'scd')
-rw-r--r-- | scd/app-openpgp.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 5fa4fd294..4d8b1bc9e 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -3580,11 +3580,23 @@ ecc_writekey (app_t app, gpg_error_t (*pincb)(void*, const char *, char **), { if (app->app_local->extcap.algo_attr_change) { - unsigned char keyattr[oid_len]; + unsigned char *keyattr; + if (!oid_len) + { + err = gpg_error (GPG_ERR_INTERNAL); + goto leave; + } + keyattr = xtrymalloc (oid_len); + if (!keyattr) + { + err = gpg_error_from_syserror (); + goto leave; + } keyattr[0] = algo; memcpy (keyattr+1, oidbuf+1, oid_len-1); err = change_keyattr (app, keyno, keyattr, oid_len, pincb, pincb_arg); + xfree (keyattr); if (err) goto leave; } |