Add missing \0
This commit is contained in:
parent
c17c953b3a
commit
9efd0bcca9
1 changed files with 2 additions and 0 deletions
|
@ -140,6 +140,7 @@ dolineprefix(const char *begin, const char *end) {
|
||||||
continue;
|
continue;
|
||||||
if(!(buffer = malloc(end - p+1)))
|
if(!(buffer = malloc(end - p+1)))
|
||||||
eprint("Malloc failed.");
|
eprint("Malloc failed.");
|
||||||
|
buffer[0] = '\0';
|
||||||
printf("\n<%s>",lineprefix[i].tag);
|
printf("\n<%s>",lineprefix[i].tag);
|
||||||
for(j = 0; p != end; p++, j++) {
|
for(j = 0; p != end; p++, j++) {
|
||||||
buffer[j] = *p;
|
buffer[j] = *p;
|
||||||
|
@ -149,6 +150,7 @@ dolineprefix(const char *begin, const char *end) {
|
||||||
p += l;
|
p += l;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
buffer[j] = '\0';
|
||||||
if(lineprefix[i].process)
|
if(lineprefix[i].process)
|
||||||
process(buffer,buffer+strlen(buffer));
|
process(buffer,buffer+strlen(buffer));
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue