minor clean up for get_keys() base64 decoded key length
authorMichael Rash <mbr@cipherdyne.org>
Fri, 1 Mar 2013 03:25:04 +0000 (22:25 -0500)
committerMichael Rash <mbr@cipherdyne.org>
Fri, 1 Mar 2013 03:25:04 +0000 (22:25 -0500)
client/fwknop.c

index adde5e9..f9cd408 100644 (file)
@@ -869,13 +869,12 @@ get_keys(fko_ctx_t ctx, fko_cli_options_t *options,
                 (unsigned char *) options->key);
         if(*key_len > 0 && *key_len < MAX_KEY_LEN)
         {
-            //memcpy(key, options->key, *key_len);
-            memcpy(key, options->key, 32);
+            memcpy(key, options->key, *key_len);
         }
         else
         {
-            printf("FIXME bad\n");
-            exit(EXIT_FAILURE);
+            fprintf(stderr, "[*] Invalid base64 decoded key length.");
+            clean_exit(ctx, options, EXIT_FAILURE);
         }
     }
     else