public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/67611] New: strcpy BUG
@ 2015-09-17 14:09 soekchl at 163 dot com
  2015-09-17 14:13 ` [Bug c/67611] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: soekchl at 163 dot com @ 2015-09-17 14:09 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67611

            Bug ID: 67611
           Summary: strcpy BUG
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: soekchl at 163 dot com
  Target Milestone: ---

So easy programing , but the luck boy found a bug.Here is the gcc version of
the source code and the process and procedures for recording results.
And g++ have a same bug.



ubuntu@ubuntu-virtual-machine:~/temp_source/201509/16$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --disable-werror
--with-arch-32=i686 --with-tune=generic --enable-checking=release
--build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
ubuntu@ubuntu-virtual-machine:~/temp_source/201509/16$ 




ubuntu@ubuntu-virtual-machine:~/temp_source/201509/16$ ls
a.out  bigNum.c  strcpy.c
ubuntu@ubuntu-virtual-machine:~/temp_source/201509/16$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/i686-linux-gnu/4.6/lto-wrapper
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object
--enable-plugin --enable-objc-gc --enable-targets=all --disable-werror
--with-arch-32=i686 --with-tune=generic --enable-checking=release
--build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 
ubuntu@ubuntu-virtual-machine:~/temp_source/201509/16$ cat strcpy.c 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char *argv[])
{
        char str[] = "0999998.000001";
        puts(str);
        strcpy(str, str+1);
        puts(str);
        return 0;
}

ubuntu@ubuntu-virtual-machine:~/temp_source/201509/16$ gcc strcpy.c -Wall
ubuntu@ubuntu-virtual-machine:~/temp_source/201509/16$ ./a.out 
0999998.000001
9999980000001
ubuntu@ubuntu-virtual-machine:~/temp_source/201509/16$


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

* [Bug c/67611] strcpy BUG
  2015-09-17 14:09 [Bug c/67611] New: strcpy BUG soekchl at 163 dot com
@ 2015-09-17 14:13 ` redi at gcc dot gnu.org
  2015-09-17 15:42 ` pinskia at gcc dot gnu.org
  2015-09-18  6:12 ` soekchl at 163 dot com
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-09-17 14:13 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67611

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Read the frabjous manual:

http://man7.org/linux/man-pages/man3/strcpy.3.html

       The strings may not overlap, and the destination string dest must be
       large enough to receive the copy.  Beware of buffer overruns!  (See
       BUGS.)


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

* [Bug c/67611] strcpy BUG
  2015-09-17 14:09 [Bug c/67611] New: strcpy BUG soekchl at 163 dot com
  2015-09-17 14:13 ` [Bug c/67611] " redi at gcc dot gnu.org
@ 2015-09-17 15:42 ` pinskia at gcc dot gnu.org
  2015-09-18  6:12 ` soekchl at 163 dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2015-09-17 15:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67611

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 67610 has been marked as a duplicate of this bug. ***


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

* [Bug c/67611] strcpy BUG
  2015-09-17 14:09 [Bug c/67611] New: strcpy BUG soekchl at 163 dot com
  2015-09-17 14:13 ` [Bug c/67611] " redi at gcc dot gnu.org
  2015-09-17 15:42 ` pinskia at gcc dot gnu.org
@ 2015-09-18  6:12 ` soekchl at 163 dot com
  2 siblings, 0 replies; 4+ messages in thread
From: soekchl at 163 dot com @ 2015-09-18  6:12 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67611

--- Comment #3 from Luke <soekchl at 163 dot com> ---
Thank you!


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

end of thread, other threads:[~2015-09-18  6:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-17 14:09 [Bug c/67611] New: strcpy BUG soekchl at 163 dot com
2015-09-17 14:13 ` [Bug c/67611] " redi at gcc dot gnu.org
2015-09-17 15:42 ` pinskia at gcc dot gnu.org
2015-09-18  6:12 ` soekchl at 163 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).