diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/funcs.c | 14 | ||||
-rw-r--r-- | src/patchlevel.h | 7 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/funcs.c b/src/funcs.c index 93f7876d..55ac6b21 100644 --- a/src/funcs.c +++ b/src/funcs.c @@ -36,9 +36,19 @@ #if defined(HAVE_WCTYPE_H) #include <wctype.h> #endif +#if defined(HAVE_LIMITS_H) +#include <limits.h> +#endif +#ifndef SIZE_T_MAX +#ifdef __LP64__ +#define SIZE_T_MAX (size_t)0xfffffffffffffffffU +#else +#define SIZE_T_MAX (size_t)0xffffffffU +#endif +#endif #ifndef lint -FILE_RCSID("@(#)$File: funcs.c,v 1.30 2007/03/25 21:46:52 christos Exp $") +FILE_RCSID("@(#)$File: funcs.c,v 1.31 2007/05/24 12:29:54 christos Exp $") #endif /* lint */ #ifndef HAVE_VSNPRINTF @@ -247,7 +257,7 @@ file_getbuffer(struct magic_set *ms) len = ms->o.size - ms->o.left; /* * 4 is for octal representation, + 1 is for NUL */ if (len > (SIZE_T_MAX - 1) / 4) { - file_oomem(ms); + file_oomem(ms, len); return NULL; } psize = len * 4 + 1; diff --git a/src/patchlevel.h b/src/patchlevel.h index c05b9393..1cf84aab 100644 --- a/src/patchlevel.h +++ b/src/patchlevel.h @@ -1,11 +1,14 @@ #define FILE_VERSION_MAJOR 4 -#define patchlevel 20 +#define patchlevel 21 /* * Patchlevel file for Ian Darwin's MAGIC command. - * $File: patchlevel.h,v 1.63 2007/01/12 17:38:28 christos Exp $ + * $File: patchlevel.h,v 1.64 2007/03/01 22:14:55 christos Exp $ * * $Log: patchlevel.h,v $ + * Revision 1.65 2007/05/24 17:22:27 christos + * Welcome to 4.21 + * * Revision 1.64 2007/03/01 22:14:55 christos * welcome to 4.20 * |