mirror of
https://github.com/openssl/openssl.git
synced 2025-02-05 14:10:53 +08:00
bio_printf: add \0 terminators for error returns in floating point conversions.
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14829)
This commit is contained in:
parent
586d9436c8
commit
d32fc2c51b
@ -620,6 +620,7 @@ fmtfp(char **sbuffer,
|
|||||||
/*
|
/*
|
||||||
* Should not happen. If we're in F_FORMAT then exp < max?
|
* Should not happen. If we're in F_FORMAT then exp < max?
|
||||||
*/
|
*/
|
||||||
|
(void)doapr_outch(sbuffer, buffer, currlen, maxlen, '\0');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -641,6 +642,7 @@ fmtfp(char **sbuffer,
|
|||||||
*/
|
*/
|
||||||
if (ufvalue >= (double)(ULONG_MAX - 65535) + 65536.0) {
|
if (ufvalue >= (double)(ULONG_MAX - 65535) + 65536.0) {
|
||||||
/* Number too big */
|
/* Number too big */
|
||||||
|
(void)doapr_outch(sbuffer, buffer, currlen, maxlen, '\0');
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
intpart = (unsigned long)ufvalue;
|
intpart = (unsigned long)ufvalue;
|
||||||
@ -704,8 +706,10 @@ fmtfp(char **sbuffer,
|
|||||||
tmpexp = (tmpexp / 10);
|
tmpexp = (tmpexp / 10);
|
||||||
} while (tmpexp > 0 && eplace < (int)sizeof(econvert));
|
} while (tmpexp > 0 && eplace < (int)sizeof(econvert));
|
||||||
/* Exponent is huge!! Too big to print */
|
/* Exponent is huge!! Too big to print */
|
||||||
if (tmpexp > 0)
|
if (tmpexp > 0) {
|
||||||
|
(void)doapr_outch(sbuffer, buffer, currlen, maxlen, '\0');
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
/* Add a leading 0 for single digit exponents */
|
/* Add a leading 0 for single digit exponents */
|
||||||
if (eplace == 1)
|
if (eplace == 1)
|
||||||
econvert[eplace++] = '0';
|
econvert[eplace++] = '0';
|
||||||
|
Loading…
Reference in New Issue
Block a user