public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/17609] New: abnormal behavior for strncpy
@ 2014-11-17  9:05 wissamg at gmail dot com
  2014-11-17  9:10 ` [Bug libc/17609] " wissamg at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: wissamg at gmail dot com @ 2014-11-17  9:05 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17609

            Bug ID: 17609
           Summary: abnormal behavior for strncpy
           Product: glibc
           Version: 2.12
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: wissamg at gmail dot com
                CC: drepper.fsp at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/17609] abnormal behavior for strncpy
  2014-11-17  9:05 [Bug libc/17609] New: abnormal behavior for strncpy wissamg at gmail dot com
@ 2014-11-17  9:10 ` wissamg at gmail dot com
  2014-11-17  9:21 ` wissamg at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: wissamg at gmail dot com @ 2014-11-17  9:10 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17609

--- Comment #1 from Wissam Ghammashi <wissamg at gmail dot com> ---
Created attachment 7944
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7944&action=edit
this a kind of a proof of concept for the bug

its a c/c++ code which I compiled using the following command:
"g++ -o strncpy -Wall -O3 strncpy.cpp"

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/17609] abnormal behavior for strncpy
  2014-11-17  9:05 [Bug libc/17609] New: abnormal behavior for strncpy wissamg at gmail dot com
                   ` (2 preceding siblings ...)
  2014-11-17  9:21 ` wissamg at gmail dot com
@ 2014-11-17  9:21 ` wissamg at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: wissamg at gmail dot com @ 2014-11-17  9:21 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17609

--- Comment #2 from Wissam Ghammashi <wissamg at gmail dot com> ---
I wrote a function that removes the '<' and '>' from email address, using
strchr, strrchr and strncpy.
And come over a bad behavior for strncpy:
I'm copying " <wis.test@hmail.vic.local.pinecoat.com>"
               ^From here                          ^Till here
             ^To here
and I'm getting the following result:
            "wis.test@hmail.vic.local.pineaoat.com"
watch the the word "pinecoat" was changes to "pineaoat"

I'm using CentOS 6.6 with:
glibc-2.12-1.149.el6.x86_64
gcc-c++-4.4.7-11.el6.x86_64
gcc-4.4.7-11.el6.x86_64
libgcc-4.4.7-11.el6.x86_64

The code sample is attached and this behavior does not happen with memcpy.


Thanks a lot,
WissaM

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/17609] abnormal behavior for strncpy
  2014-11-17  9:05 [Bug libc/17609] New: abnormal behavior for strncpy wissamg at gmail dot com
  2014-11-17  9:10 ` [Bug libc/17609] " wissamg at gmail dot com
@ 2014-11-17  9:21 ` wissamg at gmail dot com
  2014-11-17  9:21 ` wissamg at gmail dot com
  2014-11-17  9:21 ` wissamg at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: wissamg at gmail dot com @ 2014-11-17  9:21 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17609

Wissam Ghammashi <wissamg at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libc/17609] abnormal behavior for strncpy
  2014-11-17  9:05 [Bug libc/17609] New: abnormal behavior for strncpy wissamg at gmail dot com
  2014-11-17  9:10 ` [Bug libc/17609] " wissamg at gmail dot com
  2014-11-17  9:21 ` wissamg at gmail dot com
@ 2014-11-17  9:21 ` wissamg at gmail dot com
  2014-11-17  9:21 ` wissamg at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: wissamg at gmail dot com @ 2014-11-17  9:21 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=17609

Wissam Ghammashi <wissamg at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wissamg at gmail dot com

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-11-17  9:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-17  9:05 [Bug libc/17609] New: abnormal behavior for strncpy wissamg at gmail dot com
2014-11-17  9:10 ` [Bug libc/17609] " wissamg at gmail dot com
2014-11-17  9:21 ` wissamg at gmail dot com
2014-11-17  9:21 ` wissamg at gmail dot com
2014-11-17  9:21 ` wissamg at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).