Skip to content

Commit

Permalink
Fix overflow issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dr8co committed Apr 11, 2024
1 parent 3a24fa4 commit 20c2a84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lite_string.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ string_insert_string(lite_string *const restrict s, const lite_string *const res
[[nodiscard]] lite_string *string_substr(const lite_string *const restrict s, const size_t start, const size_t len) {
if (s) {
// The requested substring must be within the bounds of the string
if (len == 0 || start + len - 1 > s->size) return nullptr;
if (len == 0 || start >= s->size || len > s->size || start + len - 1 > s->size) return nullptr;

// Create a new string to store the substring
lite_string *sub = string_new();
Expand Down

0 comments on commit 20c2a84

Please sign in to comment.