From d00dc222a49a88a50e5779a0415007f214d1ac15 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Sun, 6 Jan 2013 20:22:16 +0000 Subject: [PATCH] PR/229: Fix not portable pointer comparison code. --- src/softmagic.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; -- 2.50.0