diff options
Diffstat (limited to 'string/stratcliff.c')
-rw-r--r-- | string/stratcliff.c | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/string/stratcliff.c b/string/stratcliff.c index 10c1f1f6b7..a994e569be 100644 --- a/string/stratcliff.c +++ b/string/stratcliff.c @@ -1,3 +1,23 @@ +/* Test for string function add boundaries of usable memory. + Copyright (C) 1996 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + #define _GNU_SOURCE 1 #include <errno.h> #include <stdio.h> @@ -13,7 +33,7 @@ int main (int argc, char *argv[]) { - size_t size = sysconf (_SC_PAGESIZE); + int size = sysconf (_SC_PAGESIZE); char *adr, *dest; int result = 0; @@ -52,7 +72,7 @@ main (int argc, char *argv[]) { adr[inner] = '\0'; - if (strlen (&adr[outer]) != inner - outer) + if (strlen (&adr[outer]) != (size_t) (inner - outer)) { printf ("strlen flunked for outer = %d, inner = %d\n", outer, inner); @@ -127,7 +147,7 @@ main (int argc, char *argv[]) adr[inner] = '\0'; if (strcpy (dest, &adr[outer]) != dest - || strlen (dest) != inner - outer) + || strlen (dest) != (size_t) (inner - outer)) { printf ("strcpy flunked for outer = %d, inner = %d\n", outer, inner); |