PR55982 Fix buglet in __strncat_chk

Submitted by Paul Pluzhnikov on Jan. 15, 2013, 12:57 a.m.

Details

Message ID 20130115005742.5C0D01908E4@elbrus2.mtv.corp.google.com
State New
Headers show

Commit Message

Paul Pluzhnikov Jan. 15, 2013, 12:57 a.m.
Greetings,

In libssp/strncat-chk.c, the loop was unrolled 5 times (apparently by
accident).


Ok for trunk?

Thanks,
--
Paul Pluzhnikov

2013-01-14  Paul Pluzhnikov  <ppluzhnikov@google.com>

        PR 55982
        * strncat-chk.c (__strncat_chk): Fix loop unroll.

Comments

Jakub Jelinek Jan. 15, 2013, 7:44 a.m.
On Mon, Jan 14, 2013 at 04:57:42PM -0800, Paul Pluzhnikov wrote:
> In libssp/strncat-chk.c, the loop was unrolled 5 times (apparently by
> accident).

> 2013-01-14  Paul Pluzhnikov  <ppluzhnikov@google.com>
> 
>         PR 55982
>         * strncat-chk.c (__strncat_chk): Fix loop unroll.

Ok.

	Jakub

Patch hide | download patch | download mbox

Index: libssp/strncat-chk.c
===================================================================
--- libssp/strncat-chk.c	(revision 195181)
+++ libssp/strncat-chk.c	(working copy)
@@ -87,12 +87,6 @@  __strncat_chk (char *__restrict__ dest, const char
           *++dest = c;
           if (c == '\0')
             return s;
-          if (slen-- == 0)
-            __chk_fail ();
-          c = *src++;
-          *++dest = c;
-          if (c == '\0')
-            return s;
         } while (--n4 > 0);
       n &= 3;
     }