pinosaur
/
smdp.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d2f91e2
)
fixed segv in cstring.c, closes #18
author
Michael Göhler
<somebody.here@gmx.de>
Sun, 21 Sep 2014 10:23:35 +0000
(12:23 +0200)
committer
Michael Göhler
<somebody.here@gmx.de>
Sun, 21 Sep 2014 10:23:35 +0000
(12:23 +0200)
cstring.c
patch
|
blob
|
history
diff --git
a/cstring.c
b/cstring.c
index
3eed860
..
958062b
100644
(file)
--- a/
cstring.c
+++ b/
cstring.c
@@
-47,11
+47,12
@@
void cstring_expand(cstring_t *self, char x) {
void cstring_expand_arr(cstring_t *self, char *x) {
if(self->size + strlen(x) + sizeof(char) > self->alloc) {
- self->alloc
+= (REALLOC_ADD
* sizeof(char));
+ self->alloc
= ((strlen(x) + self->size + 1)
* sizeof(char));
self->text = realloc(self->text, self->alloc);
}
self->text = strcat(self->text, x);
self->size = strlen(self->text);
+ self->text[self->size+1] = '\0';
}
void cstring_reset(cstring_t *self) {