forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0ff9718
committed
Fix inadequately-sized output buffer in contrib/unaccent.
The output buffer size in unaccent_lexize() was calculated as input stringlength times pg_database_encoding_max_length(), which effectively assumesthat replacement strings aren't more than one character. While that wasall that we previously documented it to support, the code actually hasalways allowed replacement strings of arbitrary length; so if you triedto make use of longer strings, you were at risk of buffer overrun. To fix,use an expansible StringInfo buffer instead of trying to determine themaximum space needed a-priori.This would be a security issue if unaccent rules files could be installedby unprivileged users; but fortunately they can't, so in the back branchesthe problem can be labeled as improper configuration by a superuser.Nonetheless, a memory stomp isn't a nice way of reacting to improperconfiguration, so let's back-patch the fix.1 parent555d0b2 commit0ff9718
1 file changed
+27
-24
lines changedLines changed: 27 additions & 24 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
| 19 | + | |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
| |||
267 | 268 |
| |
268 | 269 |
| |
269 | 270 |
| |
270 |
| - | |
271 |
| - | |
272 |
| - | |
273 |
| - | |
274 |
| - | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
275 | 277 |
| |
276 |
| - | |
277 | 278 |
| |
278 | 279 |
| |
| 280 | + | |
| 281 | + | |
| 282 | + | |
279 | 283 |
| |
280 | 284 |
| |
281 | 285 |
| |
282 | 286 |
| |
283 | 287 |
| |
284 |
| - | |
| 288 | + | |
285 | 289 |
| |
286 |
| - | |
287 |
| - | |
288 |
| - | |
289 |
| - | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
290 | 293 |
| |
291 |
| - | |
292 |
| - | |
293 |
| - | |
294 |
| - | |
| 294 | + | |
295 | 295 |
| |
296 |
| - | |
297 |
| - | |
298 |
| - | |
299 |
| - | |
300 |
| - | |
301 |
| - | |
302 |
| - | |
| 296 | + | |
303 | 297 |
| |
| 298 | + | |
| 299 | + | |
304 | 300 |
| |
305 | 301 |
| |
306 | 302 |
| |
307 | 303 |
| |
308 |
| - | |
309 |
| - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
310 | 313 |
| |
311 | 314 |
| |
312 | 315 |
| |
|
0 commit comments
Comments
(0)