forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1c95b5e
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 parent5c07de4 commit1c95b5e
2 files changed
+63
-34
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
368 | 368 |
| |
369 | 369 |
| |
370 | 370 |
| |
| 371 | + | |
371 | 372 |
| |
372 | 373 |
| |
373 | 374 |
| |
| |||
405 | 406 |
| |
406 | 407 |
| |
407 | 408 |
| |
408 |
| - | |
409 |
| - | |
410 |
| - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
411 | 412 |
| |
412 | 413 |
| |
413 | 414 |
| |
414 |
| - | |
| 415 | + | |
415 | 416 |
| |
416 | 417 |
| |
417 | 418 |
| |
|
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
20 | 20 |
| |
21 | 21 |
| |
22 | 22 |
| |
| 23 | + | |
23 | 24 |
| |
24 | 25 |
| |
25 | 26 |
| |
| |||
297 | 298 |
| |
298 | 299 |
| |
299 | 300 |
| |
300 |
| - | |
301 |
| - | |
302 |
| - | |
303 |
| - | |
| 301 | + | |
| 302 | + | |
304 | 303 |
| |
305 | 304 |
| |
306 |
| - | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
307 | 310 |
| |
308 |
| - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
309 | 321 |
| |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
310 | 332 |
| |
311 |
| - | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
312 | 341 |
| |
313 |
| - | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
314 | 345 |
| |
315 |
| - | |
316 |
| - | |
317 |
| - | |
| 346 | + | |
318 | 347 |
| |
319 |
| - | |
320 |
| - | |
321 |
| - | |
322 |
| - | |
323 | 348 |
| |
| 349 | + | |
324 | 350 |
| |
325 |
| - | |
326 |
| - | |
327 |
| - | |
328 |
| - | |
329 |
| - | |
330 |
| - | |
331 |
| - | |
| 351 | + | |
332 | 352 |
| |
333 |
| - | |
334 | 353 |
| |
335 |
| - | |
336 |
| - | |
337 |
| - | |
338 |
| - | |
339 |
| - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
340 | 370 |
| |
341 |
| - | |
342 | 371 |
| |
343 |
| - | |
344 | 372 |
| |
345 | 373 |
| |
346 | 374 |
| |
|
0 commit comments
Comments
(0)