tower-test: Use memmove(), not memcpy(), for overlapping memory move.
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 13 Jul 2013 15:01:46 +0000 (08:01 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 13 Jul 2013 15:01:46 +0000 (08:01 -0700)
Found by valgrind.

tests/libpspp/tower-test.c

index f5c002652a4409af5f9ef834b2d3ca0dd2f3fe82..78198cb554fb9974b69a2780723151959cee58bc 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 2007, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2010, 2013 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -442,8 +442,8 @@ test_delete (void)
                       assert (j < block_cnt - i);
                       if (expected[j].x == idx)
                         {
-                          memcpy (&expected[j], &expected[j + 1],
-                                  sizeof *expected * (block_cnt - i - j - 1));
+                          memmove (&expected[j], &expected[j + 1],
+                                   sizeof *expected * (block_cnt - i - j - 1));
                           break;
                         }
                     }