Commit f2c47d4
Fix buffer overflow vulnerability in system_property_get
Add size parameter to system_property_get() function to prevent buffer
overflow when copying command output to caller's buffer.
BUFFER OVERFLOW VULNERABILITY FIX:
- system_property_get() was writing to output buffer without size checking
- Function could overflow caller's buffer with large command output
- Added value_size parameter to all function calls
- Added bounds checking to prevent overflow
- Uses sizeof() for buffer sizes at call sites
SECURITY IMPACT:
- Prevents potential memory corruption via malicious command output
- Eliminates buffer overflow attack vector in Android property reading
- Maintains same functionality with added safety
This vulnerability could be exploited if an attacker could control the
output of the 'getprop' command to exceed the caller's buffer size.1 parent c3ac4a6 commit f2c47d4
1 file changed
Lines changed: 23 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
170 | | - | |
| 170 | + | |
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
179 | 182 | | |
180 | 183 | | |
181 | 184 | | |
| |||
194 | 197 | | |
195 | 198 | | |
196 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
197 | 214 | | |
198 | 215 | | |
199 | 216 | | |
| |||
562 | 579 | | |
563 | 580 | | |
564 | 581 | | |
565 | | - | |
| 582 | + | |
566 | 583 | | |
567 | 584 | | |
568 | 585 | | |
569 | 586 | | |
570 | 587 | | |
571 | 588 | | |
572 | 589 | | |
573 | | - | |
| 590 | + | |
574 | 591 | | |
575 | 592 | | |
576 | 593 | | |
| |||
598 | 615 | | |
599 | 616 | | |
600 | 617 | | |
601 | | - | |
| 618 | + | |
602 | 619 | | |
603 | 620 | | |
604 | 621 | | |
| |||
1883 | 1900 | | |
1884 | 1901 | | |
1885 | 1902 | | |
1886 | | - | |
| 1903 | + | |
1887 | 1904 | | |
1888 | 1905 | | |
1889 | 1906 | | |
| |||
2377 | 2394 | | |
2378 | 2395 | | |
2379 | 2396 | | |
2380 | | - | |
| 2397 | + | |
2381 | 2398 | | |
2382 | 2399 | | |
2383 | 2400 | | |
| |||
0 commit comments