projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merged from silc_1_0_branch (second merge).
[silc.git]
/
lib
/
silcutil
/
silcbuffmt.c
diff --git
a/lib/silcutil/silcbuffmt.c
b/lib/silcutil/silcbuffmt.c
index 4fffb7c34d87b7144f9007c921453c97b9e2dfe0..a189c2903a7e145fb6ccc88ee9fbd31e4b4d298a 100644
(file)
--- a/
lib/silcutil/silcbuffmt.c
+++ b/
lib/silcutil/silcbuffmt.c
@@
-532,9
+532,12
@@
int silc_buffer_strformat(SilcBuffer dst, ...)
goto ok;
dst->head = silc_realloc(dst->head, sizeof(*dst->head) *
goto ok;
dst->head = silc_realloc(dst->head, sizeof(*dst->head) *
- (strlen(string) + len));
+ (strlen(string) + len + 1));
+ if (!dst->head)
+ return -1;
memcpy(dst->head + len, string, strlen(string));
len += strlen(string);
memcpy(dst->head + len, string, strlen(string));
len += strlen(string);
+ dst->head[len] = '\0';
}
SILC_LOG_DEBUG(("Error occured while formatting buffer"));
}
SILC_LOG_DEBUG(("Error occured while formatting buffer"));
@@
-543,9
+546,9
@@
int silc_buffer_strformat(SilcBuffer dst, ...)
ok:
dst->end = dst->head + len;
ok:
dst->end = dst->head + len;
- dst->
tail = dst->data = dst->en
d;
- dst->
len = 0
;
- dst->truelen = len;
+ dst->
data = dst->hea
d;
+ dst->
tail = dst->end
;
+ dst->
len = dst->
truelen = len;
va_end(va);
return len;
va_end(va);
return len;