Commit 0af338c
committed
Fix: Add nullptr guard for sharedData_create and shmctl segment size verification
Address Copilot review feedback:
- Add sharedData_create != nullptr check before strncpy/null-termination
in all write_SM() overloads to prevent null pointer dereference when
shmat() fails in createSharedMemory()
- Add shmctl(IPC_STAT) verification in createSharedMemory() to detect
stale segments smaller than SHM_SIZE (shmget won't resize existing
segments); removes and recreates the segment when too small
- Add early return in concore.hpp createSharedMemory() on shmget failure
(was missing, unlike concoredocker.hpp which already had it)1 parent 8d6d989 commit 0af338c
2 files changed
Lines changed: 34 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
265 | 265 | | |
266 | 266 | | |
267 | 267 | | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
268 | 282 | | |
269 | 283 | | |
270 | 284 | | |
| |||
660 | 674 | | |
661 | 675 | | |
662 | 676 | | |
| 677 | + | |
| 678 | + | |
663 | 679 | | |
664 | 680 | | |
665 | 681 | | |
| |||
697 | 713 | | |
698 | 714 | | |
699 | 715 | | |
| 716 | + | |
| 717 | + | |
700 | 718 | | |
701 | 719 | | |
702 | 720 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
243 | 257 | | |
244 | 258 | | |
245 | 259 | | |
| |||
421 | 435 | | |
422 | 436 | | |
423 | 437 | | |
| 438 | + | |
| 439 | + | |
424 | 440 | | |
425 | 441 | | |
426 | 442 | | |
| |||
0 commit comments