#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: softmagic.c,v 1.211 2015/01/09 19:27:41 christos Exp $")
+FILE_RCSID("@(#)$File: softmagic.c,v 1.212 2015/01/24 22:11:25 christos Exp $")
#endif /* lint */
#include "magic.h"
bytecnt = m->str_range;
}
- if (bytecnt == 0)
- bytecnt = 8192;
- if (bytecnt > nbytes)
- bytecnt = nbytes;
+ if (bytecnt == 0 || bytecnt > nbytes - offset)
+ bytecnt = nbytes - offset;
buf = RCAST(const char *, s) + offset;
end = last = RCAST(const char *, s) + bytecnt;