mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-01-24 16:04:40 +08:00
Correct destination buffer size to strlcat
This commit is contained in:
parent
3afce176ac
commit
68f86b52c6
@ -189,7 +189,7 @@ sbuf_cat(safebuf_t *sb, const char *s2) {
|
||||
assert(SAFEBUF_CHECK(sb));
|
||||
s2len = strlen(s2);
|
||||
sbuf_grow(sb, 1 + sb->cl + s2len);
|
||||
res = strlcat(sb->buf + sb->cl, s2, sb->len);
|
||||
res = strlcat(sb->buf + sb->cl, s2, sb->len - sb->cl);
|
||||
assert( res < sb->len );
|
||||
sb->cl += s2len;
|
||||
assert(SAFEBUF_CHECK(sb));
|
||||
@ -205,7 +205,7 @@ sbuf_catb(safebuf_t *s1, const safebuf_t *s2) {
|
||||
assert(SAFEBUF_CHECK(s2));
|
||||
s2len = sbuf_len(s2);
|
||||
sbuf_grow(s1, 1 + s1->cl + s2len);
|
||||
res = strlcat(s1->buf + s1->cl, s2->buf, s1->len);
|
||||
res = strlcat(s1->buf + s1->cl, s2->buf, s1->len - s1->cl);
|
||||
assert( res < s1->len );
|
||||
s1->cl += s2len;
|
||||
assert(SAFEBUF_CHECK(s1));
|
||||
|
Loading…
Reference in New Issue
Block a user