increased buffer size, check for end

This commit is contained in:
ceriel 1987-10-22 13:35:05 +00:00
parent 16a335ab42
commit 245397491a

View file

@ -95,7 +95,7 @@ _doprnt(fmt,args,stream)
unsigned int uint ; unsigned int uint ;
register int j ; register int j ;
int i,c,rjust,width,ndigit,ndfnd,zfill; int i,c,rjust,width,ndigit,ndfnd,zfill;
char *oldfmt,*s1,buf[40]; char *oldfmt,*s1,buf[129];
nextarg = args; nextarg = args;
while (c = *fmt++) { while (c = *fmt++) {
@ -216,10 +216,12 @@ _doprnt(fmt,args,stream)
break; break;
#ifndef NOFLOAT #ifndef NOFLOAT
case 'e': case 'e':
if (ndigit >= sizeof(buf)) ndigit = sizeof(buf) - 1;
geta(&dbl,wsize(dbl)) ; geta(&dbl,wsize(dbl)) ;
s = _pscien(dbl,s,ndigit,ndfnd); s = _pscien(dbl,s,ndigit,ndfnd);
break; break;
case 'f': case 'f':
if (ndigit >= sizeof(buf)) ndigit = sizeof(buf) - 1;
geta(&dbl,wsize(dbl)) ; geta(&dbl,wsize(dbl)) ;
s = _pfloat(dbl,s,ndigit,ndfnd); s = _pfloat(dbl,s,ndigit,ndfnd);
break; break;