Commit 93e4446
Fix buffer overflow vulnerabilities in PS2 platform driver
Replace unsafe sprintf() calls with safe strlcpy using return value
offsets for concatenation. This prevents buffer overflows while
maintaining the same string construction logic.
CRITICAL SECURITY ISSUE:
- mountPoint buffer is only 10 bytes but sprintf() has no bounds checking
- partition buffer is only 50 bytes but sprintf() has no bounds checking
- Risk: Remote code execution via path string buffer overflow
Changes:
- sprintf(partition, "%s:%s", ...) -> strlcpy with offset concatenation
- sprintf(mountPoint, "%s:", ...) -> strlcpy with offset concatenation
- sprintf(newCWD, "%s%s", ...) -> strlcpy with offset concatenation
Uses strlcpy return values as offsets for safe string building.1 parent 8170665 commit 93e4446
1 file changed
Lines changed: 19 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
158 | 170 | | |
159 | 171 | | |
160 | 172 | | |
| |||
0 commit comments