[Bug 364011] [NEW] Bad string length

Gregory BELLIER dest at gatekeeper.fr
Mon Apr 20 07:59:08 UTC 2009


Public bug reported:

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.

** Affects: ocaml-inotify (Ubuntu)
     Importance: Undecided
         Status: New

-- 
Bad string length
https://bugs.launchpad.net/bugs/364011
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list