ifcfg: drop strlen() call from svEscape()

This commit is contained in:
Thomas Haller 2017-02-21 15:47:43 +01:00
parent c9f6cb9fe4
commit 8406455b4d

View file

@ -220,14 +220,12 @@ svEscape (const char *s, char **to_free)
int newlen;
size_t i, j, slen;
slen = strlen (s);
for (i = 0; i < slen; i++) {
if (_char_req_escape (s[i]))
for (slen = 0; s[slen]; slen++) {
if (_char_req_escape (s[slen]))
mangle++;
else if (_char_req_quotes (s[i]))
else if (_char_req_quotes (s[slen]))
requires_quotes = TRUE;
else if (s[i] < ' ') {
else if (s[slen] < ' ') {
/* if the string contains newline we can only express it using ANSI C quotation
* (as we don't support line continuation).
* Additionally, ANSI control characters look odd with regular quotation, so handle