Skip to content

Commit 45ab573

Browse files
committed
Use strcmp() in phpdbg_eol_global_update
memcmp() only makes sense on equal length strings, and here we don't know anything about the length of the input.
1 parent 2c8819b commit 45ab573

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sapi/phpdbg/phpdbg_eol.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ struct phpdbg_eol_rep phpdbg_eol_list[EOL_LIST_LEN] = {
3636
int phpdbg_eol_global_update(char *name)
3737
{
3838

39-
if (0 == memcmp(name, "CRLF", 4) || 0 == memcmp(name, "crlf", 4) || 0 == memcmp(name, "DOS", 3) || 0 == memcmp(name, "dos", 3)) {
39+
if (0 == strcmp(name, "CRLF") || 0 == strcmp(name, "crlf") || 0 == strcmp(name, "DOS") || 0 == strcmp(name, "dos")) {
4040
PHPDBG_G(eol) = PHPDBG_EOL_CRLF;
41-
} else if (0 == memcmp(name, "LF", 2) || 0 == memcmp(name, "lf", 2) || 0 == memcmp(name, "UNIX", 4) || 0 == memcmp(name, "unix", 4)) {
41+
} else if (0 == strcmp(name, "LF") || 0 == strcmp(name, "lf") || 0 == strcmp(name, "UNIX") || 0 == strcmp(name, "unix")) {
4242
PHPDBG_G(eol) = PHPDBG_EOL_LF;
43-
} else if (0 == memcmp(name, "CR", 2) || 0 == memcmp(name, "cr", 2) || 0 == memcmp(name, "MAC", 3) || 0 == memcmp(name, "mac", 3)) {
43+
} else if (0 == strcmp(name, "CR") || 0 == strcmp(name, "cr") || 0 == strcmp(name, "MAC") || 0 == strcmp(name, "mac")) {
4444
PHPDBG_G(eol) = PHPDBG_EOL_CR;
4545
} else {
4646
return FAILURE;

0 commit comments

Comments
 (0)