Add a missing check.

svn path=/trunk/; revision=27875
This commit is contained in:
Gerald Combs 2009-03-28 05:14:16 +00:00
parent a76381c40e
commit 6c6c89e835
1 changed files with 5 additions and 1 deletions

View File

@ -1760,7 +1760,11 @@ ep_strbuf_append(emem_strbuf_t *strbuf, const gchar *str) {
ep_strbuf_grow(strbuf, strbuf->len + add_len);
}
g_strlcpy(&strbuf->str[strbuf->len], str, strbuf->alloc_len - add_len);
if (strbuf->len + add_len > strbuf->alloc_len) {
add_len = strbuf->alloc_len - strbuf->len;
}
g_strlcpy(&strbuf->str[strbuf->len], str, add_len);
strbuf->len += add_len;
}