Erwan
2008-Mar-08 09:47 UTC
[syslinux] [PATCH 1/1] : PCI detection code doesn't corrupt memory anymore
From : Erwan Velu <erwan.velu at free.fr> This patch fixes the pci detection stuff demo'd in pcitest.c32 - Fix a wrong type in malloc - Incorrect use of strdup This two fixes makes pcitest.c32 working far better, no more crash when running it twice. I'd like to thank Sebastian Herbszt for its reports and tests. This patch was made for 3.62-pre16 but applies fine on 3.63-pre1. Signed-off-by:Erwan Velu <erwan.velu at free.fr> -------------------------------------------------------------------------------- Les opinions et prises de position emises par le signataire du present message lui sont propres et ne sauraient engager la responsabilite de la societe SEANODES. Ce message ainsi que les eventuelles pieces jointes constituent une correspondance privee et confidentielle a l'attention exclusive du destinataire designe ci-dessus. Si vous n'etes pas le destinataire du present message ou une personne susceptible de pouvoir le lui delivrer, il vous est signifie que toute divulgation, distribution ou copie de cette transmission est strictement interdite. Si vous avez recu ce message par erreur, nous vous remercions d'en informer l'expediteur par telephone ou de lui retourner le present message, puis d'effacer immediatement ce message de votre systeme. The views and opinions expressed by the author of this message are personal. SEANODES shall assume no liability, express or implied for such message. This e-mail and any attachments is a confidential correspondence intended only for use of the individual or entity named above. If you are not the intended recipient or the agent responsible for delivering the message to the intended recipient, you are hereby notified that any disclosure, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender by phone or by replying this message, and then delete this message from your system. -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: syslinux-3.62.pcifix.patch URL: <http://www.zytor.com/pipermail/syslinux/attachments/20080308/0a78a65c/attachment.ksh>
H. Peter Anvin
2008-Mar-08 10:39 UTC
[syslinux] [PATCH 1/1] : PCI detection code doesn't corrupt memory anymore
Erwan wrote:> From : Erwan Velu <erwan.velu at free.fr> > > This patch fixes the pci detection stuff demo'd in pcitest.c32 > - Fix a wrong type in malloc > - Incorrect use of strdup > > This two fixes makes pcitest.c32 working far better, no more crash when > running it twice. > > I'd like to thank Sebastian Herbszt for its reports and tests. > > This patch was made for 3.62-pre16 but applies fine on 3.63-pre1. >I notice you use strncpy() in a number of places here. strncpy() works differently from just about all the other strn*() functions, in that it doesn't make sure that the final output is zero-terminated. strncpy() really is mostly to ensure that binary output doesn't leak information, i.e. it produces *zero-padded* output (as opposed to zero-terminated.) If you're looking for something that's equivalent to "snprintf(dst, dst_len, "%s", src)" that's strlcpy() [which I'm not sure if I have in libcom32, but can be trivially added if needed.] -hpa