4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Crash because of STRCPY() being over protective of the destination
12 size. (Dominique Pelle)
13 Solution: Add -D_FORTIFY_SOURCE=1 to CFLAGS. Use an intermediate variable
14 for the pointer to avoid a warning.
15 Files: src/auto/configure, src/configure.in, src/eval.c
18 *** ../vim-7.2.043/src/auto/configure Thu Jul 24 17:20:50 2008
19 --- src/auto/configure Sun Nov 16 17:08:44 2008
22 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
25 - { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
26 - $as_echo_n "checking for GCC 3 or later... " >&6; }
28 if test "$GCC" = yes; then
29 gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
30 if test "$gccmajor" -gt "2"; then
31 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
34 ! if test "$DEPEND_CFLAGS_FILTER" = ""; then
35 ! { $as_echo "$as_me:$LINENO: result: no" >&5
38 ! { $as_echo "$as_me:$LINENO: result: yes" >&5
44 LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
48 if test "$GCC" = yes; then
49 + { $as_echo "$as_me:$LINENO: checking for GCC 3 or later" >&5
50 + $as_echo_n "checking for GCC 3 or later... " >&6; }
51 gccmajor=`echo "$gccversion" | sed -e 's/^\([1-9]\)\..*$/\1/g'`
52 if test "$gccmajor" -gt "2"; then
53 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
54 ! { $as_echo "$as_me:$LINENO: result: yes" >&5
55 ! $as_echo "yes" >&6; }
57 ! { $as_echo "$as_me:$LINENO: result: no" >&5
60 ! { $as_echo "$as_me:$LINENO: checking whether we need -D_FORTIFY_SOURCE=1" >&5
61 ! $as_echo_n "checking whether we need -D_FORTIFY_SOURCE=1... " >&6; }
62 ! if test "$gccmajor" -gt "3"; then
63 ! CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
64 ! { $as_echo "$as_me:$LINENO: result: yes" >&5
67 + { $as_echo "$as_me:$LINENO: result: no" >&5
68 + $as_echo "no" >&6; }
73 *** ../vim-7.2.043/src/configure.in Thu Jul 24 17:20:31 2008
74 --- src/configure.in Sun Nov 16 17:08:40 2008
77 dnl But only when making dependencies, cproto and lint don't take "-isystem".
78 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
79 dnl the number before the version number.
80 - AC_MSG_CHECKING(for GCC 3 or later)
82 if test "$GCC" = yes; then
83 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
84 if test "$gccmajor" -gt "2"; then
85 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
88 - if test "$DEPEND_CFLAGS_FILTER" = ""; then
93 AC_SUBST(DEPEND_CFLAGS_FILTER)
96 dnl But only when making dependencies, cproto and lint don't take "-isystem".
97 dnl Mac gcc returns "powerpc-apple-darwin8-gcc-4.0.1 (GCC)...", need to allow
98 dnl the number before the version number.
100 if test "$GCC" = yes; then
101 + AC_MSG_CHECKING(for GCC 3 or later)
102 gccmajor=`echo "$gccversion" | sed -e 's/^\([[1-9]]\)\..*$/\1/g'`
103 if test "$gccmajor" -gt "2"; then
104 DEPEND_CFLAGS_FILTER="| sed 's+-I */+-isystem /+g'"
109 + dnl -D_FORTIFY_SOURCE=2 crashes Vim on strcpy(buf, "000") when buf is
110 + dnl declared as char x[1] but actually longer. Introduced in gcc 4.0.
111 + AC_MSG_CHECKING(whether we need -D_FORTIFY_SOURCE=1)
112 + if test "$gccmajor" -gt "3"; then
113 + CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=1"
119 AC_SUBST(DEPEND_CFLAGS_FILTER)
121 *** ../vim-7.2.043/src/eval.c Wed Nov 12 15:28:37 2008
122 --- src/eval.c Sun Nov 16 20:46:28 2008
125 init_var_dict(&fc.l_avars, &fc.l_avars_var);
126 add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
127 (varnumber_T)(argcount - fp->uf_args.ga_len));
128 v = &fc.fixvar[fixvar_idx++].var;
129 ! STRCPY(v->di_key, "000");
130 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
131 hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
132 v->di_tv.v_type = VAR_LIST;
134 init_var_dict(&fc.l_avars, &fc.l_avars_var);
135 add_nr_var(&fc.l_avars, &fc.fixvar[fixvar_idx++].var, "0",
136 (varnumber_T)(argcount - fp->uf_args.ga_len));
137 + /* Use "name" to avoid a warning from some compiler that checks the
138 + * destination size. */
139 v = &fc.fixvar[fixvar_idx++].var;
141 ! STRCPY(name, "000");
142 v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
143 hash_add(&fc.l_avars.dv_hashtab, DI2HIKEY(v));
144 v->di_tv.v_type = VAR_LIST;
145 *** ../vim-7.2.043/src/version.c Thu Nov 20 10:26:19 2008
146 --- src/version.c Thu Nov 20 10:34:31 2008
150 { /* Add new patch number below this line */
156 Error:015 - Unable to exit Windows. Try the door.
158 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
159 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
160 \\\ download, build and distribute -- http://www.A-A-P.org ///
161 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///