[GH-ISSUE #1342] New keystore2john warnings #843

Closed
opened 2026-10-14 03:25:47 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @magnumripper on GitHub (May 21, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1342

Seen with clang (32-bit)

keystore2john.c:151:20: warning: comparison of constant 819200 with expression of type
      'unsigned char' is always false [-Wtautological-constant-out-of-range-compare]
                        if (sizeof(buf) < length || fread(buf, length, 1, fp) != 1)
                            ~~~~~~~~~~~ ^ ~~~~~~
keystore2john.c:177:23: warning: comparison of constant 819200 with expression of type
      'unsigned char' is always false [-Wtautological-constant-out-of-range-compare]
                                                if (sizeof(buf) < length ||
                                                    ~~~~~~~~~~~ ^ ~~~~~~
keystore2john.c:195:20: warning: comparison of constant 819200 with expression of type
      'unsigned char' is always false [-Wtautological-constant-out-of-range-compare]
                        if (sizeof(buf) < length ||
                            ~~~~~~~~~~~ ^ ~~~~~~
keystore2john.c:210:21: warning: comparison of constant 819200 with expression of type
      'unsigned char' is always false [-Wtautological-constant-out-of-range-compare]
                                if (sizeof(buf) < length ||
                                    ~~~~~~~~~~~ ^ ~~~~~~
Originally created by @magnumripper on GitHub (May 21, 2015). Original GitHub issue: https://github.com/openwall/john/issues/1342 Seen with clang (32-bit) ``` keystore2john.c:151:20: warning: comparison of constant 819200 with expression of type 'unsigned char' is always false [-Wtautological-constant-out-of-range-compare] if (sizeof(buf) < length || fread(buf, length, 1, fp) != 1) ~~~~~~~~~~~ ^ ~~~~~~ keystore2john.c:177:23: warning: comparison of constant 819200 with expression of type 'unsigned char' is always false [-Wtautological-constant-out-of-range-compare] if (sizeof(buf) < length || ~~~~~~~~~~~ ^ ~~~~~~ keystore2john.c:195:20: warning: comparison of constant 819200 with expression of type 'unsigned char' is always false [-Wtautological-constant-out-of-range-compare] if (sizeof(buf) < length || ~~~~~~~~~~~ ^ ~~~~~~ keystore2john.c:210:21: warning: comparison of constant 819200 with expression of type 'unsigned char' is always false [-Wtautological-constant-out-of-range-compare] if (sizeof(buf) < length || ~~~~~~~~~~~ ^ ~~~~~~ ```
bsakaguchi 2026-10-14 03:25:47 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@frank-dittrich commented on GitHub (May 21, 2015):

Wasn't the real problem that fgetc() returns int, but length is defined
as unsigned char?

<!-- gh-comment-id:104420585 --> @frank-dittrich commented on GitHub (May 21, 2015): Wasn't the real problem that fgetc() returns int, but length is defined as unsigned char?
Author
Owner

@magnumripper commented on GitHub (May 21, 2015):

Might be. Anyway it can't ever overflow the buffer.

<!-- gh-comment-id:104441026 --> @magnumripper commented on GitHub (May 21, 2015): Might be. Anyway it can't ever overflow the buffer.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
openwall/john#843
No description provided.