projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
34d50c3
)
VNOTE: rather use memcpy if we know the length to copy anyways.
author
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 21 Oct 2012 20:28:42 +0000
(22:28 +0200)
committer
Wilfried Goesgens
<dothebart@citadel.org>
Sun, 21 Oct 2012 20:28:42 +0000
(22:28 +0200)
libcitadel/lib/vnote.c
patch
|
blob
|
history
diff --git
a/libcitadel/lib/vnote.c
b/libcitadel/lib/vnote.c
index 3507a4087f697fec74636fdf2ad7e1a3a7f800df..c8f45b98c83e8ae5a3acab88ac28c8aeb3c58ef9 100644
(file)
--- a/
libcitadel/lib/vnote.c
+++ b/
libcitadel/lib/vnote.c
@@
-80,10
+80,10
@@
struct vnote *vnote_new_from_str(char *s) {
thisline = NULL;
nexteol = strchr(ptr, '\n');
if (nexteol) {
- thisline = malloc((nexteol - ptr) + 2);
- strncpy(thisline, ptr, (nexteol-ptr));
thisline_len = (nexteol-ptr);
- thisline[thisline_len] = 0;
+ thisline = malloc(thisline_len + 2);
+ memcpy(thisline, ptr, thisline_len);
+ thisline[thisline_len] = '\0';
ptr = nexteol + 1;
}
else {