summaryrefslogtreecommitdiffstats
path: root/g10/t-stutter.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-01-02 13:29:18 +0100
committerWerner Koch <wk@gnupg.org>2017-01-02 13:29:18 +0100
commit6b84ecbf312d98ac8cce9fe5facdc815bc742fa1 (patch)
treea607006cafbc14a6d52a054ee1a2b5d77f435d5c /g10/t-stutter.c
parentbuild: Enable gcc warnings to detect non-portable code. (diff)
downloadgnupg2-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 'g10/t-stutter.c')
-rw-r--r--g10/t-stutter.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/g10/t-stutter.c b/g10/t-stutter.c
index a2e9666bf..359cdf622 100644
--- a/g10/t-stutter.c
+++ b/g10/t-stutter.c
@@ -68,8 +68,8 @@ log_hexdump (byte *buffer, int length)
{
int have = length > 16 ? 16 : length;
int i;
- char formatted[2 * have + 1];
- char text[have + 1];
+ char formatted[2 * 16 + 1];
+ char text[16 + 1];
fprintf (stderr, "%-8d ", written);
bin2hex (buffer, have, formatted);
@@ -87,10 +87,12 @@ log_hexdump (byte *buffer, int length)
}
for (i = 0; i < have; i ++)
- if (isprint (buffer[i]))
- text[i] = buffer[i];
- else
- text[i] = '.';
+ {
+ if (isprint (buffer[i]))
+ text[i] = buffer[i];
+ else
+ text[i] = '.';
+ }
text[i] = 0;
fprintf (stderr, " ");
@@ -347,8 +349,9 @@ oracle (int debug, byte *ciphertext, int len, byte **plaintextp, byte **cfbp)
static int
oracle_test (unsigned int d, int b, int debug)
{
- byte probe[blocksize + 2];
+ byte probe[32 + 2];
+ log_assert (blocksize + 2 <= sizeof probe);
log_assert (d < 256 * 256);
if (b == 1)