projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merged silc_1_0_branch to trunk.
[silc.git]
/
lib
/
silcutil
/
silcbuffmt.c
diff --git
a/lib/silcutil/silcbuffmt.c
b/lib/silcutil/silcbuffmt.c
index 4fffb7c34d87b7144f9007c921453c97b9e2dfe0..65dd76b42c6ac102e7988b72851f6eecafbb8430 100644
(file)
--- a/
lib/silcutil/silcbuffmt.c
+++ b/
lib/silcutil/silcbuffmt.c
@@
-524,7
+524,7
@@
int silc_buffer_strformat(SilcBuffer dst, ...)
/* Parse the arguments by formatting type. */
while(1) {
/* Parse the arguments by formatting type. */
while(1) {
- char *string =
va_arg(va, char
*);
+ char *string =
(char *)va_arg(va, void
*);
if (!string)
continue;
if (!string)
continue;
@@
-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;