Return-Path: Message-ID: From: Robert Wlaschin To: "'bluez-devel@lists.sourceforge.net'" Subject: RE: [Bluez-devel] textfile.c find_key MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C5E4A2.2DF1E6B0" Sender: bluez-devel-admin@lists.sourceforge.net Errors-To: bluez-devel-admin@lists.sourceforge.net Reply-To: bluez-devel@lists.sourceforge.net List-Unsubscribe: , List-Id: BlueZ development List-Post: List-Help: List-Subscribe: , List-Archive: Date: Tue, 8 Nov 2005 12:22:45 -0800 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C5E4A2.2DF1E6B0 Content-Type: text/plain; charset="iso-8859-1" Marcel, Normally I would agree with you but I tried it and there came a NULL -- to my great surprise. I could have a bug in the kernel I'm using or something else. If you aren't sure you can always try it out yourself and if I'm wrong there you go. If you could let me know the results you get I would appreciate it. I ran textfile_get on a file that is size 0. This should replicate the bug for you. I used test_textfile to test both the problem and the 'fix' -- sadly, being that the mmap documentation says that 0 cannot be returned, I would say that the fix is a farce and mmap should be fixed instead. Thanks, Robert -----Original Message----- From: Marcel Holtmann [mailto:marcel@holtmann.org] Sent: Tuesday, November 08, 2005 11:55 AM To: bluez-devel@lists.sourceforge.net Subject: RE: [Bluez-devel] textfile.c find_key Hi Robert, > Not sure if you are interested in this but in the file textfile.c, > function find_key. If map is ever NULL the strstr will segment fault. > An instance of this happening would be when the key file was empty. > This might happen if a Linux Op was removing keys that were > invalidated by a lost pairing. I feel that in general checking for a > NULL is better than not. how can map be NULL? Check "man mmap" about the return value of mmap(). Regards Marcel ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel ------_=_NextPart_001_01C5E4A2.2DF1E6B0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable RE: [Bluez-devel] textfile.c find_key

Marcel,

Normally I would agree with you but I tried it and = there came a NULL -- to my great surprise.  I could have a bug in = the kernel I'm using or something else.  If you aren't sure you = can always try it out yourself and if I'm wrong there you go.  If = you could let me know the results you get I would appreciate = it.

I ran textfile_get on a file that is size 0.  = This should replicate the bug for you.  I used test_textfile to = test both the problem and the 'fix' -- sadly, being that the mmap = documentation says that 0 cannot be returned, I would say that the fix = is a farce and mmap should be fixed instead.

Thanks,
Robert

-----Original Message-----
From: Marcel Holtmann [mailto:marcel@holtmann.org]
Sent: Tuesday, November 08, 2005 11:55 AM
To: bluez-devel@lists.sourceforge.net
Subject: RE: [Bluez-devel] textfile.c = find_key


Hi Robert,

> Not sure if you are interested in this but in = the file textfile.c,
> function find_key.  If map is ever NULL = the strstr will segment fault.
> An instance of this happening would be when the = key file was empty.
> This might happen if a Linux Op was removing = keys that were
> invalidated by a lost pairing.  I feel = that in general checking for a
> NULL is better than not.

how can map be NULL? Check "man mmap" about = the return value of mmap().

Regards

Marcel




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's = Geronimo App Server. Download
it for free - -and be entered to win a 42" = plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-dev= el

------_=_NextPart_001_01C5E4A2.2DF1E6B0-- ------------------------------------------------------- SF.Net email is sponsored by: Tame your development challenges with Apache's Geronimo App Server. Download it for free - -and be entered to win a 42" plasma tv or your very own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php _______________________________________________ Bluez-devel mailing list Bluez-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bluez-devel