Skip to content

Commit

Permalink
Fixed out-of bounds writing bug
Browse files Browse the repository at this point in the history
offset was incremented beyond array capacity
  • Loading branch information
loulecrivain committed Nov 3, 2018
1 parent 0bec8de commit 09bc555
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Codes/ICalendarParser/ICalendarParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ void ICline::setFromICString(char *icstr){
/* still in name part, copy name and check if not
writing out-of-bounds */
this->name[name_off] = icstr[offset];
if(name_off < c_array_len(this->name))
if(name_off < c_array_len(this->name)-1)
name_off++;
}else if (semicolumn_cnt > 0 && column_cnt == 0){
/* param part, undefined behaviour (not implemented) */
Expand All @@ -278,7 +278,7 @@ void ICline::setFromICString(char *icstr){
* value part, copy value and check if not writing out
* of bounds */
this->value[value_off] = icstr[offset];
if(value_off < c_array_len(this->value))
if(value_off < c_array_len(this->value)-1)
value_off++;
}
}
Expand Down

0 comments on commit 09bc555

Please sign in to comment.