Skip to content

Commit

Permalink
Prevent segfault if there's no header passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbockelm committed Nov 24, 2024
1 parent 4fda152 commit 73a8c0d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/HTTPFile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int HTTPFile::Fstat(struct stat *buff) {
size_t next_newline = std::string::npos;
size_t last_character = headers.size();
while (current_newline != std::string::npos &&
current_newline != last_character - 1) {
current_newline != last_character - 1 && last_character) {
next_newline = headers.find("\r\n", current_newline + 2);
std::string line =
substring(headers, current_newline + 2, next_newline);
Expand Down

0 comments on commit 73a8c0d

Please sign in to comment.