diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-28 17:24:30 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-28 17:24:30 +0200 |
commit | 45ab57339e4142953f3daf8615d9443c31dcdfa5 (patch) | |
tree | ffb63dd5ee8e3b2ca0986e0e9454f52f6b1fbbd0 | |
parent | 2c8819b89cd305ed5013c7470934f3c5576d9348 (diff) | |
download | php-git-45ab57339e4142953f3daf8615d9443c31dcdfa5.tar.gz |
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.
-rw-r--r-- | sapi/phpdbg/phpdbg_eol.c | 6 |
1 files changed, 3 insertions, 3 deletions
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; |