Skip to content

Commit c8341d4

Browse files
MuradShmurad shahmammadli
andauthored
Replace strcmp with byte-by-byte comparison in valkey-check-aof (#2809)
Fixes #2792 Replace strcmp with byte-by-byte comparison to avoid accidental heap-buffer-overflow errors. Signed-off-by: murad shahmammadli <[email protected]> Co-authored-by: murad shahmammadli <[email protected]>
1 parent 2e8fba4 commit c8341d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/valkey-check-aof.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static long long line = 1;
6363
static time_t to_timestamp = 0;
6464

6565
int consumeNewline(char *buf) {
66-
if (strncmp(buf, "\r\n", 2) != 0) {
66+
if (buf[0] != '\r' || buf[1] != '\n') {
6767
ERROR("Expected \\r\\n, got: %02x%02x", buf[0], buf[1]);
6868
return 0;
6969
}

0 commit comments

Comments
 (0)