nih_str_split() can return garbage array elements.

Bug #834813 reported by James Hunt on 2011-08-26
This bug affects 1 person
Affects Status Importance Assigned to Milestone
James Hunt
libnih (Ubuntu)

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

James Hunt (jamesodhunt) wrote :

Note that it can also return an empty string array entry even if @repeat is TRUE.

James Hunt (jamesodhunt) on 2011-08-31
Changed in libnih:
assignee: nobody → James Hunt (jamesodhunt)
James Hunt (jamesodhunt) on 2011-09-07
Changed in libnih:
status: New → Fix Committed
Dimitri John Ledkov (xnox) wrote :

This bug was fixed in the package libnih - 1.0.3-4ubuntu16

libnih (1.0.3-4ubuntu16) raring; urgency=low

  * debian/{libnih1.postinst,libnih-dbus1.postinst}: Force an upgrade to
    restart Upstart (to pick up new package version) if the running
    instance supports it.
  * Merge of important fixes from lp:~upstart-devel/libnih/nih
    (LP: #776532, LP: #777097, LP: #834813, LP: #1123588).
 -- James Hunt <email address hidden> Thu, 14 Mar 2013 09:14:22 +0000

Changed in libnih (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers