1
0
mirror of https://github.com/postgres/postgres.git synced 2025-05-18 17:41:14 +03:00

to_char(): prevent accesses beyond the allocated buffer

Previously very long field masks for floats could access memory
beyond the existing buffer allocated to hold the result.

Reported by Andres Freund and Peter Geoghegan.	Backpatch to all
supported versions.

Security: CVE-2015-0241
This commit is contained in:
Bruce Momjian 2015-02-02 10:00:44 -05:00
parent fa06ce595a
commit b8b5801478

View File

@ -4416,6 +4416,8 @@ NUM_numpart_to_char(NUMProc *Np, int id)
Np->num_in = TRUE; Np->num_in = TRUE;
} }
} }
/* do no exceed string length */
if (*Np->number_p)
++Np->number_p; ++Np->number_p;
} }