<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://sourceware.org/bugzilla/bugzilla.dtd">

<bugzilla version="4.0.10"
          urlbase="http://sourceware.org/bugzilla/"
          
          maintainer="overseers@sourceware.org"
>

    <bug>
          <bug_id>13656</bug_id>
          
          <creation_ts>2012-02-02 20:52:00 +0000</creation_ts>
          <short_desc>vfprintf nargs integer overflow</short_desc>
          <delta_ts>2012-03-09 08:36:47 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>glibc</product>
          <component>stdio</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>glibc_2.14, glibc_2.15</keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Kees Cook">kees</reporter>
          <assigned_to name="Carlos O&apos;Donell">carlos</assigned_to>
          <cc>aj</cc>
    
    <cc>eggert</cc>
    
    <cc>thoger</cc>
          <cf_gcchost></cf_gcchost>
          <cf_gcctarget></cf_gcctarget>
          <cf_gccbuild></cf_gccbuild>
          

      

      

      

          <long_desc isprivate="0">
            <commentid>52908</commentid>
            <who name="Kees Cook">kees</who>
            <bug_when>2012-02-02 20:52:43 +0000</bug_when>
            <thetext>The nargs value can overflow when doing allocations, and argument-based offsets are not bounds-checked, allowing arbitrary memory writes via format strings, bypassing _FORTIFY_SOURCE protections:

http://www.phrack.org/issues.html?issue=67&amp;id=9

Patch in progress:
http://cygwin.com/ml/libc-alpha/2012-02/msg00016.html</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <commentid>53767</commentid>
            <who name="Andreas Jaeger">aj</who>
            <bug_when>2012-03-05 09:38:00 +0000</bug_when>
            <thetext>Fixed in git head, this should be backported to all active branches.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <commentid>53768</commentid>
            <who name="Tomas Hoger">thoger</who>
            <bug_when>2012-03-05 09:56:50 +0000</bug_when>
            <thetext>FYI, a comment form Laszlo Ersek in Red Hat BZ:

https://bugzilla.redhat.com/show_bug.cgi?id=794766#c8


The easiest fix would have been to restrict &quot;nargs&quot; to NL_ARGMAX.

http://www.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html#tag_13_23_03_07</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <commentid>53770</commentid>
            <who name="Andreas Jaeger">aj</who>
            <bug_when>2012-03-05 10:09:26 +0000</bug_when>
            <thetext>Tomas, could you or Laszlo bring this up on libc-alpha, please?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <commentid>53809</commentid>
            <who name="Tomas Hoger">thoger</who>
            <bug_when>2012-03-06 14:42:32 +0000</bug_when>
            <thetext>(In reply to comment #3)
&gt; Tomas, could you or Laszlo bring this up on libc-alpha, please?

This was posted in:
  http://sourceware.org/ml/libc-alpha/2012-03/msg00101.html

Replies indicate it is preferred to limit nargs by available memory rather than using an arbitrary limit, i.e. what Kees&apos; patch was doing already.

Related commit links for posterity:

http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=7c1f4834d398163d1ac8101e35e9c36fc3176e6e
http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=fa0355175d60ccf610c98f2345504603d3b8ea57</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <commentid>53892</commentid>
            <who name="Paul Eggert">eggert</who>
            <bug_when>2012-03-09 08:36:47 +0000</bug_when>
            <thetext>Fix committed:

http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=7c1f4834d398163d1ac8101e35e9c36fc3176e6e

so I am marking this bug as fixed.</thetext>
          </long_desc>
      
      

    </bug>

</bugzilla>