Commit e18c567
committed
fix(LDAPObject): Prevent memory errors in attrs_from_List
Function `PySequence_Length` can return -1 on iterables like `dict`.
The following PyMem_NEW still succeeds due `PyMem_NEW(char *, -1 + 1)`
being equivalent to `char** PyMem_Malloc(1)`, which then can result in a
segmentation fault later on.
Solution: Use `seq` and `PySequence_Fast_GET_SIZE` to determine the size of
the sequence. This way any iterable which contains only strings can be used.1 parent a1bdf47 commit e18c567
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
291 | | - | |
| 291 | + | |
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| |||
0 commit comments