nih_str_split() can return garbage array elements.
Bug #834813 reported by
James Hunt
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
libnih |
Fix Committed
|
Undecided
|
James Hunt | ||
libnih (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
If nih_str_split() is called with the args below it will return an extra array element containing random data:
char **argv = nih_str_split (NULL, "hello\n\n\n", " \t\r\n", TRUE);
What we get is:
args[0] == "hello"
args[1] == << random data >>
args[2] == NULL
What we expect is:
args[0] == "hello"
args[1] == NULL
Related branches
lp://staging/~jamesodhunt/libnih/fix-for-bug-834813
- Scott James Remnant: Pending requested
-
Diff: 440 lines (+396/-1)3 files modifiedChangeLog (+8/-0)
nih/string.c (+8/-1)
nih/tests/test_string.c (+380/-0)
Changed in libnih: | |
assignee: | nobody → James Hunt (jamesodhunt) |
Changed in libnih: | |
status: | New → Fix Committed |
To post a comment you must log in.
Note that it can also return an empty string array entry even if @repeat is TRUE.