1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Merge: Integer signedness and overflow and related fixes.

Fixes: debbugs:9079
This commit is contained in:
Paul Eggert 2011-07-27 17:48:01 -07:00
commit 044c22e545
42 changed files with 652 additions and 695 deletions

View file

@ -1,3 +1,16 @@
2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
Assume freestanding C89 headers, string.h, stdlib.h.
* ebrowse.c: Include stdlib.h unconditionally.
* etags.c, update-game-score.c:
Include string.h and stdlib.h unconditionally.
* makefile.w32-in (LOCAL_CFLAGS): Don't define STDC_HEADERS.
* movemail.c, pop.c: Include string.h unconditionally.
* update-game-score.c: No need to include stdarg.h; not used.
Assume support for memcmp, memcpy, memmove, memset.
* etags.c (absolute_filename): Assume memmove exists.
2011-07-09 Andreas Schwab <schwab@linux-m68k.org>
* update-game-score.c (usage): Update usage line.

View file

@ -20,11 +20,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
#include <stdio.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <string.h>
#include <ctype.h>
#include <assert.h>

View file

@ -138,9 +138,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
#endif /* MSDOS */
#ifdef WINDOWSNT
# include <stdlib.h>
# include <fcntl.h>
# include <string.h>
# include <direct.h>
# include <io.h>
# define MAXPATHLEN _MAX_PATH
@ -151,27 +149,6 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
# define HAVE_GETCWD
# endif /* undef HAVE_GETCWD */
#else /* not WINDOWSNT */
# ifdef STDC_HEADERS
# include <stdlib.h>
# include <string.h>
# else /* no standard C headers */
extern char *getenv (const char *);
extern char *strcpy (char *, const char *);
extern char *strncpy (char *, const char *, unsigned long);
extern char *strcat (char *, const char *);
extern char *strncat (char *, const char *, unsigned long);
extern int strcmp (const char *, const char *);
extern int strncmp (const char *, const char *, unsigned long);
extern int system (const char *);
extern unsigned long strlen (const char *);
extern void *malloc (unsigned long);
extern void *realloc (void *, unsigned long);
extern void exit (int);
extern void free (void *);
extern void *memmove (void *, const void *, unsigned long);
# define EXIT_SUCCESS 0
# define EXIT_FAILURE 1
# endif
#endif /* !WINDOWSNT */
#include <unistd.h>
@ -181,6 +158,8 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4";
# endif
#endif /* HAVE_UNISTD_H */
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
@ -6567,22 +6546,13 @@ absolute_filename (char *file, char *dir)
else if (cp[0] != '/')
cp = slashp;
#endif
#ifdef HAVE_MEMMOVE
memmove (cp, slashp + 3, strlen (slashp + 2));
#else
/* Overlapping copy isn't really okay */
strcpy (cp, slashp + 3);
#endif
slashp = cp;
continue;
}
else if (slashp[2] == '/' || slashp[2] == '\0')
{
#ifdef HAVE_MEMMOVE
memmove (slashp, slashp + 2, strlen (slashp + 1));
#else
strcpy (slashp, slashp + 2);
#endif
continue;
}
}

View file

@ -21,7 +21,7 @@ ALL = make-docfile hexl ctags etags movemail ebrowse emacsclient
.PHONY: $(ALL)
LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \
LOCAL_FLAGS = -DWINDOWSNT -DDOS_NT -DNO_LDAV=1 \
-DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \
-I../nt/inc -I../src

View file

@ -68,9 +68,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "syswait.h"
#ifdef MAIL_USE_POP
#include "pop.h"

View file

@ -65,9 +65,7 @@ extern struct servent *hes_getservbyname (/* char *, char * */);
#include <netdb.h>
#include <errno.h>
#include <stdio.h>
#ifdef STDC_HEADERS
#include <string.h>
#endif
#include <unistd.h>
#ifdef KERBEROS

View file

@ -35,12 +35,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <errno.h>
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdio.h>
#include <time.h>
#include <pwd.h>
@ -48,9 +44,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef STDC_HEADERS
#include <stdarg.h>
#endif
#include <sys/stat.h>
/* Needed for SunOS4, for instance. */