projects
/
openvswitch
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b7ff84d
)
Make ds_cstr() always null-terminate the string.
author
Ben Pfaff
<blp@nicira.com>
Mon, 29 Dec 2008 21:26:19 +0000
(13:26 -0800)
committer
Ben Pfaff
<blp@nicira.com>
Mon, 29 Dec 2008 21:26:19 +0000
(13:26 -0800)
Most of the time the string in "struct ds" is
null-terminated, but there seem to be a few corner cases
where it is not. Make ds_cstr() always put in the null
terminator, for safety.
Thanks to Justin for pointing out the problem.
lib/dynamic-string.c
patch
|
blob
|
history
diff --git
a/lib/dynamic-string.c
b/lib/dynamic-string.c
index 0c5dd5f3d7f6c55ab9799cbdb16b70c1bebe0110..03efac074df77e224b5ce33fa078c7480222d47b 100644
(file)
--- a/
lib/dynamic-string.c
+++ b/
lib/dynamic-string.c
@@
-199,8
+199,8
@@
ds_cstr(struct ds *ds)
{
if (!ds->string) {
ds_reserve(ds, 0);
- ds->string[0] = '\0';
}
+ ds->string[ds->length] = '\0';
return ds->string;
}