From: Christos Zoulas Date: Sun, 6 Jan 2013 20:22:16 +0000 (+0000) Subject: PR/229: Fix not portable pointer comparison code. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d00dc222a49a88a50e5779a0415007f214d1ac15;p=file PR/229: Fix not portable pointer comparison code. --- diff --git a/src/softmagic.c b/src/softmagic.c index 5565f328..3e550a06 100644 --- a/src/softmagic.c +++ b/src/softmagic.c @@ -32,7 +32,7 @@ #include "file.h" #ifndef lint -FILE_RCSID("@(#)$File: softmagic.c,v 1.157 2013/01/04 16:37:54 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.158 2013/01/06 20:22:16 christos Exp $") #endif /* lint */ #include "magic.h" @@ -1064,8 +1064,8 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, if (type == FILE_BESTRING16) src++; - /* check for pointer overflow */ - if (src < s) { + /* check that offset is within range */ + if (offset >= nbytes) { file_magerror(ms, "invalid offset %u in mcopy()", offset); return -1;