Browse files

Check that the input is always an even number of chars

  • Loading branch information...
1 parent c6a18ac commit a8ed5b7f8c95c107f230afa0e49445ac11aea850 @potyl committed Aug 24, 2010
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/speedkey.c
View
4 src/speedkey.c
@@ -470,6 +470,10 @@ parse_router_arg (int argc , char * const argv[]) {
/* Make sure that the target SSID is in upper case */
hex_ssid_len = strlen(ssid);
+ if (hex_ssid_len % 2) {
+ printf("Odd number of characters in SSID '%s' (%d)\n", arg, (int) hex_ssid_len);
+ exit(1);
+ }
router->bin_ssid_len = hex_ssid_len / 2;
router->hex_ssid = malloc(hex_ssid_len + 1);
router->bin_ssid = malloc(router->bin_ssid_len);

0 comments on commit a8ed5b7

Please sign in to comment.