Re: [RESEND PATCH] libpci: sysfs: Fix segmentation fault by including libgen.h

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello!

> On a musl-based system (Alpine-linux) the basename(3) function is not defined
> by including string.h with _GNU_SOURCE defined. However basename(3) could be
> defined by including libgen.h.
> 
> On musl this is a problem than can lead to a segmentation fault, as I have
> experienced. This issue is caused by basename(3) function being implicitly
> declared and thus having, implicitly, a return type of int. Which in my case
> caused an erroneous sign extension of a pointer leading to a segmentation
> fault.
> 
> Adding an include for libgen.h sound to me like a proper solution.
> Also by doing so the `_GNU_SOURCE` defined is no longer needed.

It should be fixed by commit 89cb2ae87236604b0e8ededd0fd7d9425c2d8cb6.

Could you please check if it works for you?

				Have a nice fortnight
-- 
Martin `MJ' Mareš                        <mj@xxxxxx>   http://mj.ucw.cz/
United Computer Wizards, Prague, Czech Republic, Europe, Earth, Universe
Sic transit gloria Monday!




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux