[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

strcpy HELP!!!!



I'm using libc6 2.0.7pre1-4 and strcpy gives me a segmentation
error!
I've attached my C test program for inspection(source only).

I only do a few things.  malloc memory for a variable(forgot a
corresponding free)
copy a string in this varible, copy this string to another
string, print both
on the screen.  The exact error message is attached to the
source.

I will now check bug track.

Thanks in advance 

Philip

-- 
      _                                             
     _ \ \   From Witomatic Keep, 
   / \_\ |       Home of Witwerg the Sage
  |  //o_/ | ----------------------------------     
    | \ \_/  Weilding GCC and Linux 2.0.33
     \ \_    Tschuss!  Auf Wiedsehen!
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

void main(void)
{
    char *temp1, *temp2;
    temp1 = malloc (10);
    strcpy (temp1, "high all");
    strcpy (temp2, temp1);
    printf("%s %s", temp1, temp2);
}
/* error --- program recieved signal SIGSEGV, Segmentation Fault.
 * 0x40050be7*/

Reply to: