forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit5c89684
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 parente81e8f9 commit5c89684
2 files changed
+63
-34
lines changedLines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
417 | 417 |
| |
418 | 418 |
| |
419 | 419 |
| |
| 420 | + | |
420 | 421 |
| |
421 | 422 |
| |
422 | 423 |
| |
| |||
454 | 455 |
| |
455 | 456 |
| |
456 | 457 |
| |
457 |
| - | |
458 |
| - | |
459 |
| - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
460 | 461 |
| |
461 | 462 |
| |
462 | 463 |
| |
463 |
| - | |
| 464 | + | |
464 | 465 |
| |
465 | 466 |
| |
466 | 467 |
| |
|
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 |
| |
| |||
315 | 316 |
| |
316 | 317 |
| |
317 | 318 |
| |
318 |
| - | |
319 |
| - | |
320 |
| - | |
321 |
| - | |
| 319 | + | |
| 320 | + | |
322 | 321 |
| |
323 | 322 |
| |
324 |
| - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
325 | 328 |
| |
326 |
| - | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
327 | 339 |
| |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
328 | 350 |
| |
329 |
| - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
330 | 359 |
| |
331 |
| - | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
332 | 363 |
| |
333 |
| - | |
334 |
| - | |
335 |
| - | |
| 364 | + | |
336 | 365 |
| |
337 |
| - | |
338 |
| - | |
339 |
| - | |
340 |
| - | |
341 | 366 |
| |
| 367 | + | |
342 | 368 |
| |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 |
| - | |
347 |
| - | |
348 |
| - | |
349 |
| - | |
| 369 | + | |
350 | 370 |
| |
351 |
| - | |
352 | 371 |
| |
353 |
| - | |
354 |
| - | |
355 |
| - | |
356 |
| - | |
357 |
| - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
358 | 388 |
| |
359 |
| - | |
360 | 389 |
| |
361 |
| - | |
362 | 390 |
| |
363 | 391 |
| |
364 | 392 |
| |
|
0 commit comments
Comments
(0)