This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/17609] abnormal behavior for strncpy
- From: "wissamg at gmail dot com" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 17 Nov 2014 09:21:11 +0000
- Subject: [Bug libc/17609] abnormal behavior for strncpy
- Auto-submitted: auto-generated
- References: <bug-17609-131 at http dot sourceware dot org/bugzilla/>
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.