Skip to content

Commit

Permalink
Improve check in parses header for robustness.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielGavin committed Sep 30, 2023
1 parent 08a0019 commit aef651f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/server/requests.odin
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ read_and_parse_header :: proc(reader: ^Reader) -> (Header, bool) {

message := strings.to_string(builder)

if len(message) == 0 || message[len(message) - 2] != '\r' {
if len(message) < 2 || message[len(message) - 2] != '\r' {
log.error("No carriage return")
return header, false
}
Expand Down Expand Up @@ -1051,9 +1051,9 @@ notification_did_save :: proc(
uri: common.Uri

if uri, ok = common.parse_uri(
save_params.textDocument.uri,
context.temp_allocator,
); !ok {
save_params.textDocument.uri,
context.temp_allocator,
); !ok {
return .ParseError
}

Expand Down

0 comments on commit aef651f

Please sign in to comment.