]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: str_append_[tab]unescaped(): Don't truncate input at NULs
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 21 Apr 2018 12:44:11 +0000 (15:44 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 30 Aug 2018 08:15:28 +0000 (11:15 +0300)
For str_append_tabunescaped() the input is supposed to have NULs already
escaped though, so it was truncating only with invalid input.

src/lib/strescape.c

index f32285b6b87c88b6ec0782a6bc30bc559a095df5..505005525439609ca0f76bd29ac75a3d7febb6e7 100644 (file)
@@ -41,7 +41,7 @@ void str_append_unescaped(string_t *dest, const void *src, size_t src_size)
                                break;
                }
 
-               str_append_n(dest, src_c + start, i-start);
+               str_append_data(dest, src_c + start, i-start);
 
                if (i < src_size) {
                        if (++i == src_size)
@@ -164,7 +164,7 @@ void str_append_tabunescaped(string_t *dest, const void *src, size_t src_size)
                                break;
                }
 
-               str_append_n(dest, src_c + start, i-start);
+               str_append_data(dest, src_c + start, i-start);
 
                if (i < src_size) {
                        i++;