nih_str_split() can return garbage array elements.

Bug #834813 reported by James Hunt
6
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

Revision history for this message
James Hunt (jamesodhunt) wrote :

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

James Hunt (jamesodhunt)
Changed in libnih:
assignee: nobody → James Hunt (jamesodhunt)
James Hunt (jamesodhunt)
Changed in libnih:
status: New → Fix Committed
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.