ia64/xen-unstable

view stubdom/newlib-chk.patch @ 19481:f6fd1c2e4da6

stubdom: Add newlib-chk.patch

From: "George S. Coker, II" <gscoker@alpha.ncsc.mil>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Mar 31 18:37:58 2009 +0100 (2009-03-31)
parents
children dbc4014882d0
line source
1 diff -Naur newlib-1.16.0/newlib/libc/stdio/fprintf_chk.c newlib-1.16.0/newlib/libc/stdio/fprintf_chk.c
2 --- newlib-1.16.0/newlib/libc/stdio/fprintf_chk.c 1969-12-31 19:00:00.000000000 -0500
3 +++ newlib-1.16.0/newlib/libc/stdio/fprintf_chk.c 2009-02-26 19:02:53.000000000 -0500
4 @@ -0,0 +1,21 @@
5 +#include <stdarg.h>
6 +#include <stdio.h>
7 +
8 +/*
9 + * Stub implementation of __fprintf_chk adapted from glibc 2.7. This
10 + * doesn't actually implement any buffer overflow protection. It just makes
11 + * the linker happy :)
12 +*/
13 +int
14 +__fprintf_chk (FILE *fp, int flag, const char *format, ...)
15 +{
16 + va_list ap;
17 + int done;
18 +
19 + va_start (ap, format);
20 + done = vfprintf (fp, format, ap);
21 + va_end (ap);
22 +
23 + return done;
24 +}
25 +
26 diff -Naur newlib-1.16.0/newlib/libc/stdio/Makefile.am newlib-1.16.0/newlib/libc/stdio/Makefile.am
27 --- ./newlib-1.16.0/newlib/libc/stdio/Makefile.am 2007-08-02 16:23:06.000000000 -0400
28 +++ ./newlib-1.16.0/newlib/libc/stdio/Makefile.am 2009-02-26 18:14:53.000000000 -0500
29 @@ -20,6 +20,7 @@
30 flags.c \
31 fopen.c \
32 fprintf.c \
33 + fprintf_chk.c \
34 fputc.c \
35 fputs.c \
36 fread.c \
37 @@ -65,6 +66,7 @@
38 sniprintf.c \
39 snprintf.c \
40 sprintf.c \
41 + sprintf_chk.c \
42 sscanf.c \
43 stdio.c \
44 tmpfile.c \
45 diff -Naur newlib-1.16.0/newlib/libc/stdio/Makefile.in newlib-1.16.0/newlib/libc/stdio/Makefile.in
46 --- newlib-1.16.0/newlib/libc/stdio/Makefile.in 2007-12-19 17:36:38.000000000 -0500
47 +++ newlib-1.16.0/newlib/libc/stdio/Makefile.in 2009-02-26 18:43:52.000000000 -0500
48 @@ -63,7 +63,8 @@
49 lib_a-fgets.$(OBJEXT) lib_a-fileno.$(OBJEXT) \
50 lib_a-findfp.$(OBJEXT) lib_a-fiprintf.$(OBJEXT) \
51 lib_a-flags.$(OBJEXT) lib_a-fopen.$(OBJEXT) \
52 - lib_a-fprintf.$(OBJEXT) lib_a-fputc.$(OBJEXT) \
53 + lib_a-fprintf.$(OBJEXT) lib_a-fprintf_chk.$(OBJEXT) \
54 + lib_a-fputc.$(OBJEXT) \
55 lib_a-fputs.$(OBJEXT) lib_a-fread.$(OBJEXT) \
56 lib_a-freopen.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \
57 lib_a-fiscanf.$(OBJEXT) lib_a-fseek.$(OBJEXT) \
58 @@ -86,6 +87,7 @@
59 lib_a-setvbuf.$(OBJEXT) lib_a-siprintf.$(OBJEXT) \
60 lib_a-siscanf.$(OBJEXT) lib_a-sniprintf.$(OBJEXT) \
61 lib_a-snprintf.$(OBJEXT) lib_a-sprintf.$(OBJEXT) \
62 + lib_a-sprintf_chk.$(OBJEXT) \
63 lib_a-sscanf.$(OBJEXT) lib_a-stdio.$(OBJEXT) \
64 lib_a-tmpfile.$(OBJEXT) lib_a-tmpnam.$(OBJEXT) \
65 lib_a-ungetc.$(OBJEXT) lib_a-vdiprintf.$(OBJEXT) \
66 @@ -122,15 +124,15 @@
67 LTLIBRARIES = $(noinst_LTLIBRARIES)
68 am__objects_4 = clearerr.lo fclose.lo fdopen.lo feof.lo ferror.lo \
69 fflush.lo fgetc.lo fgetpos.lo fgets.lo fileno.lo findfp.lo \
70 - fiprintf.lo flags.lo fopen.lo fprintf.lo fputc.lo fputs.lo \
71 - fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
72 + fiprintf.lo flags.lo fopen.lo fprintf.lo fprintf_chk.lo fputc.lo \
73 + fputs.lo fread.lo freopen.lo fscanf.lo fiscanf.lo fseek.lo fsetpos.lo \
74 ftell.lo fvwrite.lo fwalk.lo fwrite.lo getc.lo getchar.lo \
75 getc_u.lo getchar_u.lo getdelim.lo getline.lo gets.lo \
76 iprintf.lo iscanf.lo makebuf.lo perror.lo printf.lo putc.lo \
77 putchar.lo putc_u.lo putchar_u.lo puts.lo refill.lo remove.lo \
78 rename.lo rewind.lo rget.lo scanf.lo sccl.lo setbuf.lo \
79 setbuffer.lo setlinebuf.lo setvbuf.lo siprintf.lo siscanf.lo \
80 - sniprintf.lo snprintf.lo sprintf.lo sscanf.lo stdio.lo \
81 + sniprintf.lo snprintf.lo sprintf.lo sprintf_chk.lo sscanf.lo stdio.lo \
82 tmpfile.lo tmpnam.lo ungetc.lo vdiprintf.lo vdprintf.lo \
83 viprintf.lo viscanf.lo vprintf.lo vscanf.lo vsiprintf.lo \
84 vsiscanf.lo vsnprintf.lo vsniprintf.lo vsprintf.lo vsscanf.lo \
85 @@ -344,6 +346,7 @@
86 flags.c \
87 fopen.c \
88 fprintf.c \
89 + fprintf_chk.c \
90 fputc.c \
91 fputs.c \
92 fread.c \
93 @@ -389,6 +392,7 @@
94 sniprintf.c \
95 snprintf.c \
96 sprintf.c \
97 + sprintf_chk.c \
98 sscanf.c \
99 stdio.c \
100 tmpfile.c \
101 @@ -508,6 +512,7 @@
102 siprintf.def \
103 siscanf.def \
104 sprintf.def \
105 + sprintf_chk.def \
106 sscanf.def \
107 tmpfile.def \
108 tmpnam.def \
109 @@ -678,6 +683,12 @@
110 lib_a-fprintf.obj: fprintf.c
111 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi`
113 +lib_a-fprintf_chk.o: fprintf_chk.c
114 + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.o `test -f 'fprintf_chk.c' || echo '$(srcdir)/'`fprintf_chk.c
115 +
116 +lib_a-fprintf_chk.obj: fprintf_chk.c
117 + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf_chk.obj `if test -f 'fprintf_chk.c'; then $(CYGPATH_W) 'fprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/fprintf_chk.c'; fi`
118 +
119 lib_a-fputc.o: fputc.c
120 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c
122 @@ -948,6 +959,12 @@
123 lib_a-sprintf.obj: sprintf.c
124 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf.obj `if test -f 'sprintf.c'; then $(CYGPATH_W) 'sprintf.c'; else $(CYGPATH_W) '$(srcdir)/sprintf.c'; fi`
126 +lib_a-sprintf_chk.o: sprintf_chk.c
127 + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c
128 +
129 +lib_a-sprintf_chk.obj: sprintf_chk.c
130 + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi`
131 +
132 lib_a-sscanf.o: sscanf.c
133 $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sscanf.o `test -f 'sscanf.c' || echo '$(srcdir)/'`sscanf.c
135 diff -Naur ./newlib-1.16.0/newlib/libc/stdio/sprintf_chk.c ../newlib-1.16.0/newlib/libc/stdio/sprintf_chk.c
136 --- newlib-1.16.0/newlib/libc/stdio/sprintf_chk.c 1969-12-31 19:00:00.000000000 -0500
137 +++ newlib-1.16.0/newlib/libc/stdio/sprintf_chk.c 2009-02-26 19:02:26.000000000 -0500
138 @@ -0,0 +1,21 @@
139 +#include <stdarg.h>
140 +#include <stdio.h>
141 +
142 +/*
143 + * Stub implementation of __sprintf_chk adapted from glibc 2.7. This
144 + * doesn't actually implement any buffer overflow protection. It just makes
145 + * the linker happy :)
146 +*/
147 +int
148 +__sprintf_chk (char *s, int flags, size_t slen, const char *format, ...)
149 +{
150 + va_list arg;
151 + int done;
152 +
153 + va_start (arg, format);
154 + done = vsprintf (s, format, arg);
155 + va_end (arg);
156 +
157 + return done;
158 +}
159 +