! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Thunar crash due to passing null to strcmp()
Status:
RESOLVED: FIXED

Comments

Description Guido Falsi 2019-01-18 18:10:13 CET
Created attachment 8252 
proposed patch

Hi,

In the FreeBSD thunar port (which I maintain) I'm including the attached patch.

I created it to solve a user bug report you can view here:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=217946

The second attachment there, shows the crash in strcmp(), further investigation in gdb let me discover NULL was being passed to it sometimes.

My patch replaces NULL unsafe strcmp() calls with g_strcmp0() calls which don't crash when being passed NULLs.

This actually solved the problem here. I'm sorry I don't have much more evidence, and producing it now would be cumbersome, but I could do that if strictly required and given some time to collect it.

Hope this patch can be included.


Please note that I'm setting the affected version to 1.6.15 since I tested there, but I see the same code in 1.8.2 so I assume the problem persists there.

I'm anyway in the process of setting up an environment to test XFCE 4.13, so I'll know for sure once done.
Comment 1 alexxcons editbugs 2019-01-18 23:00:07 CET
Thanks for the patch !

It looks good to me ... dont think there is any advantage in using strcmp directly (possibly 3 CPU cycles saved)

Will add it to master, 4.12 and 4.14 branch.

Who should get the credits for it ? (Whom should I put as author ?)

As far  as I read the bsd bugreport, so far you did not find out why NULL is passed there in the first place ?
Comment 2 Guido Falsi 2019-01-18 23:45:22 CET
Great! Thanks.

I got the patch from bug 12264 comment 77. I should have specified this in my first comment, but I did not have the reference handy.

I was unable to actually find out where the nulls were coming from, but that comment has some insight about this that maybe people more familiar with thunar code can make use of.
Comment 3 Git Bot editbugs 2019-01-19 22:55:24 CET
Roy Richardson referenced this bugreport in commit e52cdf73c437a1f0007632bf6a10c984924204b5

FreeBSD -Thunar crash due to passing null to strcmp() (Bug #15059)

https://git.xfce.org/xfce/thunar/commit?id=e52cdf73c437a1f0007632bf6a10c984924204b5
Comment 4 Git Bot editbugs 2019-01-19 22:57:02 CET
Roy Richardson referenced this bugreport in commit d9521391850478ec569c563f7768b58174aa4f4a

FreeBSD -Thunar crash due to passing null to strcmp() (Bug #15059)

https://git.xfce.org/xfce/thunar/commit?id=d9521391850478ec569c563f7768b58174aa4f4a
Comment 5 Git Bot editbugs 2019-01-19 23:06:49 CET
Roy Richardson referenced this bugreport in commit b1b693cf122a1a95c7a2b497ccdef49b6a8bc81a

FreeBSD -Thunar crash due to passing null to strcmp() (Bug #15059)

https://git.xfce.org/xfce/thunar/commit?id=b1b693cf122a1a95c7a2b497ccdef49b6a8bc81a
Comment 6 alexxcons editbugs 2019-01-19 23:09:33 CET
Fixed for master, xfce-4.14 and xfce-4.12 branches

Soon to be released into thunar 1.8.3 and 1.6.16
Comment 7 Guido Falsi 2019-01-19 23:57:43 CET
Thanks!

Bug #15059

Reported by:
Guido Falsi
Reported on: 2019-01-18
Last modified on: 2019-01-19

People

Assignee:
Xfce Bug Triage
CC List:
3 users

Version

Version:
1.6.15

Attachments

proposed patch (704 bytes, patch)
2019-01-18 18:10 CET , Guido Falsi
no flags

Additional information