Re: Segment fault ../sysdeps/i386/i686/multiarch/strcpy-sse2.S

2015-08-29 Thread Thomas Schmitt
Hi, Lev Lazinskiy wrote: > str = malloc (5); malloc(6) or else "hello" will produce a buffer overflow by its trailing 0. > free(str); Yes. This is a good idea when the memory is no longer needed. (Kids: Do this only once per malloc/calloc.) > > http://crashworks.org/if_programming_langua

Re: Segment fault ../sysdeps/i386/i686/multiarch/strcpy-sse2.S

2015-08-29 Thread Lev Lazinskiy
On Sat, 2015-08-29 at 09:14 +0200, Thomas Schmitt wrote: > > Recreational: > http://crashworks.org/if_programming_languages_were_vehicles/ This is amazing, I have not seen this before. Thanks for sharing :) Best, Lev -- @levlaz | https://levlaz.org signature.asc Description: This is a digit

Re: Segment fault ../sysdeps/i386/i686/multiarch/strcpy-sse2.S

2015-08-29 Thread Thomas Schmitt
Hi, Dan Richard wrote > char *str;   strcpy(str, "hello"); You are writing to a random memory location. The pointer str is not initialized to point to valid memory, which you would have to allocate previously. Try instead char str[100]; strcpy(str, "hello"); This is good for strings up t

Re: Segment fault ../sysdeps/i386/i686/multiarch/strcpy-sse2.S

2015-08-29 Thread Lev Lazinskiy
On Sat, 2015-08-29 at 08:54 +0200, Dan Richard wrote: > My Debian is with kernel 4.0.0-2-rt-686-pae, and gcc (Debian 4.9.2 > -10) 4.9.2. > > I have a program where it uses strcpy, but when executing > (compilation successfully), it throws segment fault. Debugging with > gdb, it shows that it g

Segment fault ../sysdeps/i386/i686/multiarch/strcpy-sse2.S

2015-08-28 Thread Dan Richard
My Debian is with kernel 4.0.0-2-rt-686-pae, and gcc (Debian 4.9.2-10) 4.9.2.    I have a program where it uses strcpy, but when executing (compilation successfully), it throws segment fault. Debugging with gdb, it shows that it goes worng in strcpy function.    _strcpy_sse2 () at ../sysdeps/i3