summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristos Zoulas <christos@zoulas.com>2022-08-17 08:47:47 +0000
committerChristos Zoulas <christos@zoulas.com>2022-08-17 08:47:47 +0000
commitb556ee126ef6e063e5660e7c0a56bc7daea6b1fb (patch)
tree9db98d04227ff91887395482d82d4d579678b4c4
parentf8426d776649a99b962e5b2fa41fe105e4e48f14 (diff)
downloadfile-git-b556ee126ef6e063e5660e7c0a56bc7daea6b1fb.tar.gz
PR/374: piru: avoid infinite loop in non-wide code
-rw-r--r--src/file.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/file.c b/src/file.c
index c0b8aa19..e01380aa 100644
--- a/src/file.c
+++ b/src/file.c
@@ -32,7 +32,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: file.c,v 1.202 2022/07/26 15:10:05 christos Exp $")
+FILE_RCSID("@(#)$File: file.c,v 1.203 2022/08/17 08:47:47 christos Exp $")
#endif /* lint */
#include "magic.h"
@@ -675,7 +675,7 @@ file_mbswidth(struct magic_set *ms, const char *s)
s += bytesconsumed, n -= bytesconsumed;
}
#else
- while (*s) {
+ for (; *s; s++) {
width += (ms->flags & MAGIC_RAW) != 0
|| isprint(CAST(unsigned char, *s)) ? 1 : 4;
}