diff options
author | Werner Koch <[email protected]> | 2017-01-02 12:29:18 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2017-01-02 12:29:18 +0000 |
commit | 6b84ecbf312d98ac8cce9fe5facdc815bc742fa1 (patch) | |
tree | a607006cafbc14a6d52a054ee1a2b5d77f435d5c /g10/gpgcompose.c | |
parent | build: Enable gcc warnings to detect non-portable code. (diff) | |
download | gnupg-6b84ecbf312d98ac8cce9fe5facdc815bc742fa1.tar.gz gnupg-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 <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | g10/gpgcompose.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/g10/gpgcompose.c b/g10/gpgcompose.c index 512cb450a..fafbfd274 100644 --- a/g10/gpgcompose.c +++ b/g10/gpgcompose.c @@ -1654,13 +1654,17 @@ mksubpkt_callback (PKT_signature *sig, void *cookie) if (si->reason_for_revocation) { - int l = 1 + strlen (si->reason_for_revocation); - char buf[l]; + int len = 1 + strlen (si->reason_for_revocation); + char *buf; + + buf = xmalloc (len); buf[0] = si->reason_for_revocation_code; - memcpy (&buf[1], si->reason_for_revocation, l - 1); + memcpy (&buf[1], si->reason_for_revocation, len - 1); + + build_sig_subpkt (sig, SIGSUBPKT_REVOC_REASON, buf, len); - build_sig_subpkt (sig, SIGSUBPKT_REVOC_REASON, buf, l); + xfree (buf); } if (si->features) @@ -2540,10 +2544,13 @@ encrypted (const char *option, int argc, char *argv[], void *cookie) if (do_debug) { - char buf[2 * session_key.keylen + 1]; + char *buf; + + buf = xmalloc (2 * session_key.keylen + 1); debug ("session key: algo: %d; keylen: %d; key: %s\n", session_key.algo, session_key.keylen, bin2hex (session_key.key, session_key.keylen, buf)); + xfree (buf); } if (strcmp (option, "--encrypted-mdc") == 0) |