Bad string length

Bug #364011 reported by Gregory BELLIER
2
Affects Status Importance Assigned to Milestone
ocaml-inotify (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: libinotify-ocaml-dev

Ubuntu version concerned : jaunty and older
Severity : important
Found in version 0.7
Fixed in version 0.9

Hi guys !

I filled a report on the Debian's bug tracking and I'm now reporting it here.
You can find the full report which is now closed here : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=521870

This bug is in the package libinotify-ocaml-dev v0.7 and older version which means jaunty and older are concerned.
I don't know if you have time to patch your tree before releasing jaunty.

Anyway, there is a bug in the file inotify.ml.

There is a temporary buffer made of lots of \0.
The problem is that we create a new string based on this buffer. The len
is wrong so the fresh string contains too much \0.
For example: say you're monitoring a directory then you create a new
directory named "a".
Because of this event, inotify will notify that a new directory has been
created. Its name length ? 16 chars.
That's right 16 chars instead of 1. I noticed this error because of a
badly working concat.

I patched the sources in order to print the error :
ocamlc unix.cma -I /usr/lib/ocaml/3.10.2/inotify/ inotify.cma -o
test_err test.inotify.ml

mkdir /tmp/dev

./test_err /tmp/dev 2> hello2.txt

mkdir /tmp/dev/a

cat hello2.txt
We're in inotify_stubs.c
# bytes returned from ioctl: 32
From here, we're in inotify.ml
# toread (it's what we get from inotify_stubs) : 32
Length of string 'a' = 16
Let's iterate on this string to print all chars :
'a' '' '' '' '' '' '' '' '' '' '' ''
'' '' '' ''

As you can see with the '', there are too much \0 in the string but I
think the line "Length of string 'a' = 16" speaks for itself.

I've been in contact with the bind's author of inotify -> ocaml and he released the 0.9 (see attachment) as a patch for this bug.

Regards,
Gregory "Dest" BELLIER.

Revision history for this message
Gregory BELLIER (dest-gatekeeper) wrote :
Changed in ocaml-inotify (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.