diff options
| author | Paul Eggert | 2011-07-27 17:48:01 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-07-27 17:48:01 -0700 |
| commit | 044c22e545acef592ed95e4e3bb9f8aeff67291a (patch) | |
| tree | 167a4c706b62b12ea979bdf6ad47e70b66bb0394 /lib-src | |
| parent | dbf38e02c9ade4979418f24a99962cfef170b957 (diff) | |
| parent | 8265d3bb30544e58683fc16e23f9908f3d5d0abc (diff) | |
| download | emacs-044c22e545acef592ed95e4e3bb9f8aeff67291a.tar.gz emacs-044c22e545acef592ed95e4e3bb9f8aeff67291a.zip | |
Merge: Integer signedness and overflow and related fixes.
Fixes: debbugs:9079
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 13 | ||||
| -rw-r--r-- | lib-src/ebrowse.c | 4 | ||||
| -rw-r--r-- | lib-src/etags.c | 34 | ||||
| -rw-r--r-- | lib-src/makefile.w32-in | 2 | ||||
| -rw-r--r-- | lib-src/movemail.c | 2 | ||||
| -rw-r--r-- | lib-src/pop.c | 2 | ||||
| -rw-r--r-- | lib-src/update-game-score.c | 7 |
7 files changed, 16 insertions, 48 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 2a4c1024293..c878d313b70 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2011-07-28 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Assume freestanding C89 headers, string.h, stdlib.h. | ||
| 4 | * ebrowse.c: Include stdlib.h unconditionally. | ||
| 5 | * etags.c, update-game-score.c: | ||
| 6 | Include string.h and stdlib.h unconditionally. | ||
| 7 | * makefile.w32-in (LOCAL_CFLAGS): Don't define STDC_HEADERS. | ||
| 8 | * movemail.c, pop.c: Include string.h unconditionally. | ||
| 9 | * update-game-score.c: No need to include stdarg.h; not used. | ||
| 10 | |||
| 11 | Assume support for memcmp, memcpy, memmove, memset. | ||
| 12 | * etags.c (absolute_filename): Assume memmove exists. | ||
| 13 | |||
| 1 | 2011-07-09 Andreas Schwab <schwab@linux-m68k.org> | 14 | 2011-07-09 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 15 | ||
| 3 | * update-game-score.c (usage): Update usage line. | 16 | * update-game-score.c (usage): Update usage line. |
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index 7871a804997..a997e56cc9f 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c | |||
| @@ -20,11 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 20 | 20 | ||
| 21 | #include <config.h> | 21 | #include <config.h> |
| 22 | #include <stdio.h> | 22 | #include <stdio.h> |
| 23 | |||
| 24 | #ifdef HAVE_STDLIB_H | ||
| 25 | #include <stdlib.h> | 23 | #include <stdlib.h> |
| 26 | #endif | ||
| 27 | |||
| 28 | #include <string.h> | 24 | #include <string.h> |
| 29 | #include <ctype.h> | 25 | #include <ctype.h> |
| 30 | #include <assert.h> | 26 | #include <assert.h> |
diff --git a/lib-src/etags.c b/lib-src/etags.c index 693c999047f..522c54ee4a5 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -138,9 +138,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 138 | #endif /* MSDOS */ | 138 | #endif /* MSDOS */ |
| 139 | 139 | ||
| 140 | #ifdef WINDOWSNT | 140 | #ifdef WINDOWSNT |
| 141 | # include <stdlib.h> | ||
| 142 | # include <fcntl.h> | 141 | # include <fcntl.h> |
| 143 | # include <string.h> | ||
| 144 | # include <direct.h> | 142 | # include <direct.h> |
| 145 | # include <io.h> | 143 | # include <io.h> |
| 146 | # define MAXPATHLEN _MAX_PATH | 144 | # define MAXPATHLEN _MAX_PATH |
| @@ -151,27 +149,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 151 | # define HAVE_GETCWD | 149 | # define HAVE_GETCWD |
| 152 | # endif /* undef HAVE_GETCWD */ | 150 | # endif /* undef HAVE_GETCWD */ |
| 153 | #else /* not WINDOWSNT */ | 151 | #else /* not WINDOWSNT */ |
| 154 | # ifdef STDC_HEADERS | ||
| 155 | # include <stdlib.h> | ||
| 156 | # include <string.h> | ||
| 157 | # else /* no standard C headers */ | ||
| 158 | extern char *getenv (const char *); | ||
| 159 | extern char *strcpy (char *, const char *); | ||
| 160 | extern char *strncpy (char *, const char *, unsigned long); | ||
| 161 | extern char *strcat (char *, const char *); | ||
| 162 | extern char *strncat (char *, const char *, unsigned long); | ||
| 163 | extern int strcmp (const char *, const char *); | ||
| 164 | extern int strncmp (const char *, const char *, unsigned long); | ||
| 165 | extern int system (const char *); | ||
| 166 | extern unsigned long strlen (const char *); | ||
| 167 | extern void *malloc (unsigned long); | ||
| 168 | extern void *realloc (void *, unsigned long); | ||
| 169 | extern void exit (int); | ||
| 170 | extern void free (void *); | ||
| 171 | extern void *memmove (void *, const void *, unsigned long); | ||
| 172 | # define EXIT_SUCCESS 0 | ||
| 173 | # define EXIT_FAILURE 1 | ||
| 174 | # endif | ||
| 175 | #endif /* !WINDOWSNT */ | 152 | #endif /* !WINDOWSNT */ |
| 176 | 153 | ||
| 177 | #include <unistd.h> | 154 | #include <unistd.h> |
| @@ -181,6 +158,8 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 181 | # endif | 158 | # endif |
| 182 | #endif /* HAVE_UNISTD_H */ | 159 | #endif /* HAVE_UNISTD_H */ |
| 183 | 160 | ||
| 161 | #include <stdlib.h> | ||
| 162 | #include <string.h> | ||
| 184 | #include <stdio.h> | 163 | #include <stdio.h> |
| 185 | #include <ctype.h> | 164 | #include <ctype.h> |
| 186 | #include <errno.h> | 165 | #include <errno.h> |
| @@ -6567,22 +6546,13 @@ absolute_filename (char *file, char *dir) | |||
| 6567 | else if (cp[0] != '/') | 6546 | else if (cp[0] != '/') |
| 6568 | cp = slashp; | 6547 | cp = slashp; |
| 6569 | #endif | 6548 | #endif |
| 6570 | #ifdef HAVE_MEMMOVE | ||
| 6571 | memmove (cp, slashp + 3, strlen (slashp + 2)); | 6549 | memmove (cp, slashp + 3, strlen (slashp + 2)); |
| 6572 | #else | ||
| 6573 | /* Overlapping copy isn't really okay */ | ||
| 6574 | strcpy (cp, slashp + 3); | ||
| 6575 | #endif | ||
| 6576 | slashp = cp; | 6550 | slashp = cp; |
| 6577 | continue; | 6551 | continue; |
| 6578 | } | 6552 | } |
| 6579 | else if (slashp[2] == '/' || slashp[2] == '\0') | 6553 | else if (slashp[2] == '/' || slashp[2] == '\0') |
| 6580 | { | 6554 | { |
| 6581 | #ifdef HAVE_MEMMOVE | ||
| 6582 | memmove (slashp, slashp + 2, strlen (slashp + 1)); | 6555 | memmove (slashp, slashp + 2, strlen (slashp + 1)); |
| 6583 | #else | ||
| 6584 | strcpy (slashp, slashp + 2); | ||
| 6585 | #endif | ||
| 6586 | continue; | 6556 | continue; |
| 6587 | } | 6557 | } |
| 6588 | } | 6558 | } |
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in index 07f6170afe4..28f913a4df6 100644 --- a/lib-src/makefile.w32-in +++ b/lib-src/makefile.w32-in | |||
| @@ -21,7 +21,7 @@ ALL = make-docfile hexl ctags etags movemail ebrowse emacsclient | |||
| 21 | 21 | ||
| 22 | .PHONY: $(ALL) | 22 | .PHONY: $(ALL) |
| 23 | 23 | ||
| 24 | LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \ | 24 | LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DNO_LDAV=1 \ |
| 25 | -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \ | 25 | -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \ |
| 26 | -I../nt/inc -I../src | 26 | -I../nt/inc -I../src |
| 27 | 27 | ||
diff --git a/lib-src/movemail.c b/lib-src/movemail.c index e8c09f090f3..d70c655adec 100644 --- a/lib-src/movemail.c +++ b/lib-src/movemail.c | |||
| @@ -68,9 +68,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 68 | #ifdef HAVE_FCNTL_H | 68 | #ifdef HAVE_FCNTL_H |
| 69 | #include <fcntl.h> | 69 | #include <fcntl.h> |
| 70 | #endif | 70 | #endif |
| 71 | #ifdef HAVE_STRING_H | ||
| 72 | #include <string.h> | 71 | #include <string.h> |
| 73 | #endif | ||
| 74 | #include "syswait.h" | 72 | #include "syswait.h" |
| 75 | #ifdef MAIL_USE_POP | 73 | #ifdef MAIL_USE_POP |
| 76 | #include "pop.h" | 74 | #include "pop.h" |
diff --git a/lib-src/pop.c b/lib-src/pop.c index 426b39bd1fb..a94e06fbd87 100644 --- a/lib-src/pop.c +++ b/lib-src/pop.c | |||
| @@ -65,9 +65,7 @@ extern struct servent *hes_getservbyname (/* char *, char * */); | |||
| 65 | #include <netdb.h> | 65 | #include <netdb.h> |
| 66 | #include <errno.h> | 66 | #include <errno.h> |
| 67 | #include <stdio.h> | 67 | #include <stdio.h> |
| 68 | #ifdef STDC_HEADERS | ||
| 69 | #include <string.h> | 68 | #include <string.h> |
| 70 | #endif | ||
| 71 | #include <unistd.h> | 69 | #include <unistd.h> |
| 72 | 70 | ||
| 73 | #ifdef KERBEROS | 71 | #ifdef KERBEROS |
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c index 76483c371ff..2a89379aefe 100644 --- a/lib-src/update-game-score.c +++ b/lib-src/update-game-score.c | |||
| @@ -35,12 +35,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | 35 | ||
| 36 | #include <unistd.h> | 36 | #include <unistd.h> |
| 37 | #include <errno.h> | 37 | #include <errno.h> |
| 38 | #ifdef HAVE_STRING_H | ||
| 39 | #include <string.h> | 38 | #include <string.h> |
| 40 | #endif | ||
| 41 | #ifdef HAVE_STDLIB_H | ||
| 42 | #include <stdlib.h> | 39 | #include <stdlib.h> |
| 43 | #endif | ||
| 44 | #include <stdio.h> | 40 | #include <stdio.h> |
| 45 | #include <time.h> | 41 | #include <time.h> |
| 46 | #include <pwd.h> | 42 | #include <pwd.h> |
| @@ -48,9 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 48 | #ifdef HAVE_FCNTL_H | 44 | #ifdef HAVE_FCNTL_H |
| 49 | #include <fcntl.h> | 45 | #include <fcntl.h> |
| 50 | #endif | 46 | #endif |
| 51 | #ifdef STDC_HEADERS | ||
| 52 | #include <stdarg.h> | ||
| 53 | #endif | ||
| 54 | #include <sys/stat.h> | 47 | #include <sys/stat.h> |
| 55 | 48 | ||
| 56 | /* Needed for SunOS4, for instance. */ | 49 | /* Needed for SunOS4, for instance. */ |