From 45ab57339e4142953f3daf8615d9443c31dcdfa5 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 28 Jun 2019 17:24:30 +0200 Subject: 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. --- sapi/phpdbg/phpdbg_eol.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sapi/phpdbg/phpdbg_eol.c') diff --git a/sapi/phpdbg/phpdbg_eol.c b/sapi/phpdbg/phpdbg_eol.c index dc4e07c76c..4115ea449b 100644 --- a/sapi/phpdbg/phpdbg_eol.c +++ b/sapi/phpdbg/phpdbg_eol.c @@ -36,11 +36,11 @@ struct phpdbg_eol_rep phpdbg_eol_list[EOL_LIST_LEN] = { int phpdbg_eol_global_update(char *name) { - if (0 == memcmp(name, "CRLF", 4) || 0 == memcmp(name, "crlf", 4) || 0 == memcmp(name, "DOS", 3) || 0 == memcmp(name, "dos", 3)) { + if (0 == strcmp(name, "CRLF") || 0 == strcmp(name, "crlf") || 0 == strcmp(name, "DOS") || 0 == strcmp(name, "dos")) { PHPDBG_G(eol) = PHPDBG_EOL_CRLF; - } else if (0 == memcmp(name, "LF", 2) || 0 == memcmp(name, "lf", 2) || 0 == memcmp(name, "UNIX", 4) || 0 == memcmp(name, "unix", 4)) { + } else if (0 == strcmp(name, "LF") || 0 == strcmp(name, "lf") || 0 == strcmp(name, "UNIX") || 0 == strcmp(name, "unix")) { PHPDBG_G(eol) = PHPDBG_EOL_LF; - } else if (0 == memcmp(name, "CR", 2) || 0 == memcmp(name, "cr", 2) || 0 == memcmp(name, "MAC", 3) || 0 == memcmp(name, "mac", 3)) { + } else if (0 == strcmp(name, "CR") || 0 == strcmp(name, "cr") || 0 == strcmp(name, "MAC") || 0 == strcmp(name, "mac")) { PHPDBG_G(eol) = PHPDBG_EOL_CR; } else { return FAILURE; -- cgit v1.2.1