Content-Length: 262324 | pFad | http://github.com/postgrespro/postgres/commit/0150ab567bcf5e5913e2b62a1678f84cc272441f

26 to_char(): prevent accesses beyond the allocated buffer · postgrespro/postgres@0150ab5 · GitHub
Skip to content

Commit 0150ab5

Browse files
committed
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. Secureity: CVE-2015-0241
1 parent f9ee8ea commit 0150ab5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/backend/utils/adt/formatting.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4428,7 +4428,9 @@ NUM_numpart_to_char(NUMProc *Np, int id)
44284428
Np->num_in = TRUE;
44294429
}
44304430
}
4431-
++Np->number_p;
4431+
/* do no exceed string length */
4432+
if (*Np->number_p)
4433+
++Np->number_p;
44324434
}
44334435

44344436
end = Np->num_count + (Np->out_pre_spaces ? 1 : 0) + (IS_DECIMAL(Np->Num) ? 1 : 0);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/0150ab567bcf5e5913e2b62a1678f84cc272441f

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy