forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit2883674
committed
Fix race condition in pg_ctl reading postmaster.pid.
If postmaster changed postmaster.pid while pg_ctl was reading it, pg_ctlcould overrun the buffer it allocated for the file. Fix by reading thewhole file to memory with one read() call.initdb contains an identical copy of the readfile() function, but the filesthat initdb reads are static, not modified concurrently. Nevertheless, adda simple bounds-check there, if only to silence static analysis tools.Per report from Dave Vitek. Backpatch to all supported branches.1 parenteb5e0d8 commit2883674
2 files changed
+63
-34
lines changedLines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
373 | 373 |
| |
374 | 374 |
| |
375 | 375 |
| |
| 376 | + | |
376 | 377 |
| |
377 | 378 |
| |
378 | 379 |
| |
| |||
410 | 411 |
| |
411 | 412 |
| |
412 | 413 |
| |
413 |
| - | |
414 |
| - | |
415 |
| - | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
416 | 417 |
| |
417 | 418 |
| |
418 | 419 |
| |
419 |
| - | |
| 420 | + | |
420 | 421 |
| |
421 | 422 |
| |
422 | 423 |
| |
|
Lines changed: 58 additions & 30 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
| |
| |||
305 | 306 |
| |
306 | 307 |
| |
307 | 308 |
| |
308 |
| - | |
309 |
| - | |
310 |
| - | |
311 |
| - | |
| 309 | + | |
| 310 | + | |
312 | 311 |
| |
313 | 312 |
| |
314 |
| - | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
315 | 318 |
| |
316 |
| - | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
317 | 329 |
| |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
318 | 340 |
| |
319 |
| - | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
320 | 349 |
| |
321 |
| - | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
322 | 353 |
| |
323 |
| - | |
324 |
| - | |
325 |
| - | |
| 354 | + | |
326 | 355 |
| |
327 |
| - | |
328 |
| - | |
329 |
| - | |
330 |
| - | |
331 | 356 |
| |
| 357 | + | |
332 | 358 |
| |
333 |
| - | |
334 |
| - | |
335 |
| - | |
336 |
| - | |
337 |
| - | |
338 |
| - | |
339 |
| - | |
| 359 | + | |
340 | 360 |
| |
341 |
| - | |
342 | 361 |
| |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
348 | 378 |
| |
349 |
| - | |
350 | 379 |
| |
351 |
| - | |
352 | 380 |
| |
353 | 381 |
| |
354 | 382 |
| |
|
0 commit comments
Comments
(0)