浏览代码

check src < *out only; only check for \nspace if src < *out - 2

*out will never be NULL here, so we only need to check that src < *out as
the loop condition
when looking for a continuation line, make sure there are two characters
in *out to check
Rich Megginson 15 年之前
父节点
当前提交
685cb4c361
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      ldap/servers/slapd/ldaputil.c

+ 2 - 2
ldap/servers/slapd/ldaputil.c

@@ -384,8 +384,8 @@ slapi_ldif_put_type_and_value_with_options( char **out, const char *t, const cha
         /* modify out in place, stripping out continuation lines */
         char *src = save;
         char *dest = save;
-        for (; src && *src && (src != *out); ++src) {
-            if (!strncmp(src, "\n ", 2)) {
+        for (; src < *out; ++src) {
+            if ((src < (*out - 2)) && !strncmp(src, "\n ", 2)) {
                 src += 2; /* skip continuation */
             }
             *dest++ = *src;