Repository navigation
Commit aaf2547
committed
gh-162010: Drop pending literal on rejected imaplib.APPEND commands
When IMAP4.append() is called, it stores the message payload in self.literal and calls _command('APPEND', ...). Following gh-143921 (CVE-2025-15366), if any argument contains control characters (NUL, CR, or LF), _command() raises ValueError before popping and clearing self.literal. This left self.literal pending on the client instance, attaching itself as an unexpected literal to whatever command was executed next (such as NOOP).
Ingest and clear self.literal into local scope at the start of _command(), guaranteeing that any exception occurring prior to transmission drops the literal immediately and prevents session corruption or data leakage.1 parent 8750d38 commit aaf2547
3 files changed
Lines changed: 29 additions & 3 deletions
File tree
- Lib
- test
- Misc/NEWS.d/next/Security
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1408 | 1408 | | |
1409 | 1409 | | |
1410 | 1410 | | |
1411 | | - | |
| 1411 | + | |
| 1412 | + | |
1412 | 1413 | | |
| 1414 | + | |
| 1415 | + | |
1413 | 1416 | | |
1414 | 1417 | | |
1415 | 1418 | | |
| |||
1434 | 1437 | | |
1435 | 1438 | | |
1436 | 1439 | | |
1437 | | - | |
1438 | 1440 | | |
1439 | | - | |
1440 | 1441 | | |
1441 | 1442 | | |
1442 | 1443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2326 | 2326 | | |
2327 | 2327 | | |
2328 | 2328 | | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
| 2345 | + | |
| 2346 | + | |
| 2347 | + | |
| 2348 | + | |
| 2349 | + | |
| 2350 | + | |
2329 | 2351 | | |
2330 | 2352 | | |
2331 | 2353 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments