bug-hurd
[Top][All Lists]
Advanced

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

[patch #3350] printk may cause buffer overruns


From: Neal H. Walfield
Subject: [patch #3350] printk may cause buffer overruns
Date: Wed, 08 Sep 2004 08:06:57 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040413 Debian/1.6-5

This mail is an automated notification from the patch tracker
 of the project: The GNU Hurd.




/**************************************************************************/
[patch #3350] Full Item Snapshot:

URL: <http://savannah.gnu.org/patch/?func=detailitem&item_id=3350>
Project: The GNU Hurd
Submitted by: Neal H. Walfield
On: Wed 09/08/04 at 10:36

Category:  GNU Mach
Priority:  5 - Normal
Resolution:  None
Privacy:  Public
Assigned to:  None
Originator Email:  
Status:  Open


Summary:  printk may cause buffer overruns

Original Submission:  The implementation of printk in linux/dev/kernel/printk.c 
assumes that
the formatted string is less than sizeof (buf) - 3 (BUF being a statically
allocated string of 2048 bytes).  Code in Linux violates this assumption.
For instance, linux/src/drivers/pci/pci.c:pci_init which prints out the
pci bus topography if debugging is enabled.  I looked at writing a
linux_vsnprintf to replace the linux_vsprintf, however, the code is a mess
and the Mach printf code is much easier to work with (kern/printf.c).
Hence, I modified that.

Thanks.

2004-09-08  Neal H. Walfield  <neal@cs.uml.edu>

        * linux/dev/kernel/printk.c: Include <kern/assert.h>.
        (printk): Use vsnprintf, not linux_vsprintf to avoid buffer
        overruns.

        * kern/printf.c (struct vsnprintf_cookie): New structure.
        (snputc): New function.
        (vsnprintf): Likewise.







File Attachments
-------------------

-------------------------------------------------------
Date: Wed 09/08/04 at 10:36  Name: printf.diff  Size: 2.18KB   By: neal

http://savannah.gnu.org/patch/download.php?item_id=3350&amp;item_file_id=3650






For detailed info, follow this link:
<http://savannah.gnu.org/patch/?func=detailitem&item_id=3350>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]