Fix trimming of non-escaped trailing space in ldif_parse_attribute().

Found by PVS-Studio.
This commit is contained in:
Todd C. Miller
2018-10-18 14:29:33 -06:00
parent c2d93b8c97
commit 2ff8f8601b

View File

@@ -117,10 +117,11 @@ ldif_parse_attribute(char *str)
ep = str + strlen(str); ep = str + strlen(str);
while (ep > str && ep[-1] == ' ') { while (ep > str && ep[-1] == ' ') {
/* Don't trim ecaped trailing space if not base64. */ ep--;
if (!encoded && ep != str && ep[-2] == '\\') /* Don't trim escaped trailing space if not base64. */
if (!encoded && ep != str && ep[-1] == '\\')
break; break;
*--ep = '\0'; *ep = '\0';
} }
attr = str; attr = str;