0 Replies Latest reply on Mar 25, 2013 6:04 AM by 998880

    strcpy problem overlapping source and destination in 64 bit.

      A simple program like the following when compiled for 64 bit, it gives wrong result in some of the 64bit m/c.

      /* a.c */
      #include <stdio.h>
      #include <string.h>
      int main()
      char st[50];
      char *p = st + 2;
      return 0;

      cc -o check_copy -m64 a.c

      On running check_copy, the expected answer is "1234", but in some m/c this gives "1434" .

      The libc.so.1 in both the m/cs are different.

      The result is correct in older SunOS.
      uname -a in two m/cs ( old_mc and new_mc )
      SunOS old_mc 5.10 Generic_127112-05 i86pc i386 i86pc [ Gives correct result ]
      SunOS new_mc 5.10 Generic_147441-01 i86pc i386 i86pc [ Gives wrong result ]

      Both the m/c s have 118855-36 patch, which I believe is for libc.so.1.

      As our s/w is large one, it will be difficult to have a code fix, as there will be many instances of the above scenario and which triggered in very rare usecases.

      Any help, regarding the patch details which can fix this issue..