chiark / gitweb /
Replace use of variable-length-arrays.
[gnupg2.git] / g10 / t-stutter.c
index a2e9666bf7c5db6e43737073217aef4064010903..359cdf622c8c528330158094a6a746db3b675dab 100644 (file)
@@ -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)