[AtModem] Fix ArgumentOutOfRangeException when header value is empty#1538
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: nanoframework/coderabbit/.coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe ChangesHTTP Header Bounds Validation
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@dotnet-policy-service agree |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
/azp runpipeline |
|
Command 'runpipeline' is not supported by Azure Pipelines. Supported commands
See additional documentation. |
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
ArgumentOutOfRangeException when header value is empty
Fix bounds check when header value is empty (e.g., "Authorization:")
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Description
Substringcall inWebHeaderCollection.Add(string header)method.ArgumentOutOfRangeExceptionwhen header ends with ':' and has no value (e.g.,"Authorization:").Motivation and Context
Add(string header)with a header string that has no value after the colon (e.g.,"Authorization:") causes a crash becauseSubstring(colpos + 1)is called without checking bounds.ArgumentOutOfRangeExceptionwhen header value is empty System.Net.Http#488.How Has This Been Tested?
curl -H "Authorization:" http://<device-ip>/hello.ArgumentOutOfRangeExceptionwhen header value is empty System.Net.Http#488.Screenshots
Types of changes
Checklist: