Repository navigation
Commit 9e68b08
committed
fix(windows): use wcsnlen for all string operations (CWE-126)
Refactor Utf8FromUtf16 to use bounded string length for all operations:
1. Calculate input_length using wcsnlen with UNICODE_STRING_MAX_CHARS
2. Use explicit length in WideCharToMultiByte instead of -1
3. Use static_cast instead of C-style casts
4. Remove the -1 adjustment since explicit length doesn't include null
This fully addresses the CWE-126 buffer over-read concern by ensuring
no operation reads beyond the bounded length.
Fixes flutter#1804181 parent e9d336d commit 9e68b08
1 file changed
Lines changed: 9 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
49 | 55 | | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
| 56 | + | |
55 | 57 | | |
56 | | - | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
0 commit comments