mirror of
https://github.com/simh/simh.git
synced 2026-01-13 15:27:14 +00:00
SCP: sprint_val comma bug
- Fix comma separator code segmentation fault: "ndigit - 3" can become a very large unsigned number for ndigit < 3.
This commit is contained in:
parent
eab060315e
commit
f7dfefee72
2
scp.c
2
scp.c
@ -12459,7 +12459,7 @@ switch (format) {
|
||||
break;
|
||||
ndigits = MAX_WIDTH - digit;
|
||||
commas = (ndigits - 1)/3;
|
||||
for (digit=0; digit<ndigits-3; digit++)
|
||||
for (digit=0; (digit + 3) < ndigits; digit++)
|
||||
dbuf[MAX_WIDTH + (digit - ndigits) - (ndigits - digit - 1)/3] = dbuf[MAX_WIDTH + (digit - ndigits)];
|
||||
for (digit=1; digit<=commas; digit++)
|
||||
dbuf[MAX_WIDTH - (digit * 4)] = ',';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user