Browse Source

helper.pl - detect sizeof without brackets

Karel Miko 8 years ago
parent
commit
b7e35e9f57
2 changed files with 2 additions and 1 deletions
  1. 1 0
      helper.pl
  2. 1 1
      src/ciphers/des.c

+ 1 - 0
helper.pl

@@ -55,6 +55,7 @@ sub check_source {
       push @{$troubles->{unwanted_strcmp}},  $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrcmp\s*\(/;
       push @{$troubles->{unwanted_strcmp}},  $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bstrcmp\s*\(/;
       push @{$troubles->{unwanted_clock}},   $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bclock\s*\(/;
       push @{$troubles->{unwanted_clock}},   $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bclock\s*\(/;
       push @{$troubles->{unwanted_qsort}},   $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bqsort\s*\(/;
       push @{$troubles->{unwanted_qsort}},   $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bqsort\s*\(/;
+      push @{$troubles->{sizeof_no_brackets}}, $lineno if $file =~ /^src\/.*\.c$/ && $l =~ /\bsizeof\s*[^\(]/;
       if ($file =~ m|src/.*\.c$| &&
       if ($file =~ m|src/.*\.c$| &&
           $file !~ m|src/ciphers/.*\.c$| &&
           $file !~ m|src/ciphers/.*\.c$| &&
           $file !~ m|src/hashes/.*\.c$| &&
           $file !~ m|src/hashes/.*\.c$| &&

+ 1 - 1
src/ciphers/des.c

@@ -1383,7 +1383,7 @@ static void cookey(const ulong32 *raw1, ulong32 *keyout)
         *cook++ |= (*raw1 & 0x0000003fL);
         *cook++ |= (*raw1 & 0x0000003fL);
     }
     }
 
 
-    XMEMCPY(keyout, dough, sizeof dough);
+    XMEMCPY(keyout, dough, sizeof(dough));
 }
 }
 
 
 #ifdef LTC_CLEAN_STACK
 #ifdef LTC_CLEAN_STACK