Skip to content

Commit

Permalink
coverity 263769 dereference before null check
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Oct 23, 2019
1 parent e872ac5 commit 30da3cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions common/crapto1/crypto1.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
(x = (x >> 8 & 0xff00ff) | (x & 0xff00ff) << 8, x = x >> 16 | x << 16)

void crypto1_init(struct Crypto1State *state, uint64_t key) {
if (state == NULL)
return;
state->odd = 0;
state->even = 0;

int i;

for (i = 47; state && i > 0; i -= 2) {
for (int i = 47; i > 0; i -= 2) {
state->odd = state->odd << 1 | BIT(key, (i - 1) ^ 7);
state->even = state->even << 1 | BIT(key, i ^ 7);
}
Expand Down

0 comments on commit 30da3cf

Please sign in to comment.