From b186b4a4ad8b4e6927bb7fd578db572d44bd0712 Mon Sep 17 00:00:00 2001 From: Christos Zoulas Date: Sat, 11 Aug 2018 11:44:24 +0000 Subject: [PATCH] PR/26: Include the line terminator character so that regex's that match to the end of line work. --- src/softmagic.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/softmagic.c b/src/softmagic.c index 9a5db9d3..3220e1dd 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.262 2018/06/22 20:39:50 christos Exp $") +FILE_RCSID("@(#)$File: softmagic.c,v 1.263 2018/08/11 11:44:24 christos Exp $") #endif /* lint */ #include "magic.h" @@ -1301,9 +1301,11 @@ mcopy(struct magic_set *ms, union VALUETYPE *p, int type, int indir, || (b = CAST(const char *, memchr(c, '\r', CAST(size_t, (end - c)))))); lines--, b++) { - last = b; if (b < end - 1 && b[0] == '\r' && b[1] == '\n') b++; + if (b < end - 1 && b[0] == '\n') + b++; + last = b; } if (lines) last = end; -- 2.40.0