Commit ec046ee
Fix copy-paste bugs in settings.c for TlsServerMaxSendBuffer (#5823)
Three copy-paste bugs in `src/core/settings.c` caused
`TlsServerMaxSendBuffer` to never be properly initialized with its
default value or propagated during settings merge/copy. A full scan of
the file confirmed no further instances of this pattern remain.
## Description
- **Default initialization** (`QuicSettingsSetDefault`): Second `if`
block was checking/assigning `TlsClientMaxSendBuffer` with
`QUIC_MAX_TLS_SERVER_SEND_BUFFER` — corrected to check and assign
`TlsServerMaxSendBuffer`.
- **Settings copy/merge** (`QuicSettingsCopy`): Two duplicate blocks
(exact copies of the `TlsClientMaxSendBuffer` block) were silently
no-ops for `TlsServerMaxSendBuffer` — both corrected to operate on
`TlsServerMaxSendBuffer` (one at the originally reported location ~line
530, and one additional instance found at line 249).
- **Full scan**: All three functions that follow this pattern
(`QuicSettingsSetDefault`, `QuicSettingsCopy`, `QuicSettingsMerge`) were
audited and confirmed to have no remaining instances of this bug.
## Testing
No existing tests cover these specific fields directly. The bugs were
logic errors (dead/duplicate code paths), not behavioral regressions, so
no new tests are added.
## Documentation
No documentation impact.
<!-- START COPILOT ORIGINAL PROMPT -->
<details>
<summary>Original prompt</summary>
>
> ----
>
> *This section details on the original issue you should resolve*
>
> <issue_title>Duplicate code in `src/core/settings.c`</issue_title>
> <issue_description>
> ## Source
> 1. In `src/core/settings.c`, [Lines
530-533](https://github.com/microsoft/msquic/blob/main/src/core/settings.c#L530-L533)
and [Lines
534-537](https://github.com/microsoft/msquic/blob/main/src/core/settings.c#L534-L537)
are exactly the same.
> 2. [Lines
90-92](https://github.com/microsoft/msquic/blob/main/src/core/settings.c#L90-L92)
and [Lines
93-95](https://github.com/microsoft/msquic/blob/main/src/core/settings.c#L93-L95)
are almost the same, except in the line 95
`Settings->TlsClientMaxSendBuffer` is set to
`QUIC_MAX_TLS_SERVER_SEND_BUFFER` (which was previously set to
`QUIC_MAX_TLS_CLIENT_SEND_BUFFER`.
>
> </issue_description>
>
> <agent_instructions>Fix the issue, remove duplicate
code</agent_instructions>
>
> ## Comments on the Issue (you are @copilot in this section)
>
> <comments>
> </comments>
>
</details>
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #5822
<!-- START COPILOT CODING AGENT TIPS -->
---
🔒 GitHub Advanced Security automatically protects Copilot coding agent
pull requests. You can protect all pull requests by enabling Advanced
Security for your repositories. [Learn more about Advanced
Security.](https://gh.io/cca-advanced-security)
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: saikat107 <2145576+saikat107@users.noreply.github.com>1 parent d87376c commit ec046ee
1 file changed
+7
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
93 | | - | |
94 | | - | |
| 93 | + | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
246 | 246 | | |
247 | 247 | | |
248 | 248 | | |
249 | | - | |
250 | | - | |
| 249 | + | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| |||
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
534 | | - | |
535 | | - | |
536 | | - | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| |||
0 commit comments