ish: fix an infinite loop on unsigned char archs

Decoding using the -lf option on powerpc made ish freeze. A looped
fgetc(3) call never reached EOF, since the return value was stored
as a char, that is unsigned on powerpc and arm*, instead of int.

OK jca@
This commit is contained in:
cwen 2021-07-24 19:26:54 +00:00
parent f8fd489ec9
commit cd0438c481
2 changed files with 18 additions and 5 deletions

View File

@ -1,9 +1,10 @@
# $OpenBSD: Makefile,v 1.24 2019/07/14 02:16:51 naddy Exp $
# $OpenBSD: Makefile,v 1.25 2021/07/24 19:26:54 cwen Exp $
COMMENT= binary-to-text file converter
DISTNAME= ish201a5
PKGNAME= ish-2.01a5
REVISION= 0
CATEGORIES= converters
PERMIT_PACKAGE= no license

View File

@ -1,9 +1,11 @@
$OpenBSD: patch-decode_c,v 1.1 2011/12/30 23:14:34 sthen Exp $
$OpenBSD: patch-decode_c,v 1.2 2021/07/24 19:26:54 cwen Exp $
Fix: When decoding, the status display has Y2K problem.
Hunk #1: When decoding, the status display has Y2K problem.
Hunk #2: fix an infinite loop on unsigned char archs (powerpc and arm*)
--- decode.c.orig Sun Jan 7 10:46:37 1996
+++ decode.c Fri Dec 30 23:09:44 2011
Index: decode.c
--- decode.c.orig
+++ decode.c
@@ -273,8 +273,8 @@ ish_head *head;
tm.tm_min = (p[1]&0x07)<<3;
tm.tm_min += p[0]>>5;
@ -15,3 +17,13 @@ Fix: When decoding, the status display has Y2K problem.
#ifdef __TURBOC__
memcpy( &timep[0], head->time, 4);
timep[1] = timep[0];
@@ -675,8 +675,7 @@ FILE *ipath;
int maxlen;
char *buff;
{
- int i,j;
- char c;
+ int c,i,j;
if((decok & 0x80) == 0)
j=78;