Fix buffer overflow when displaying measurements
This commit is contained in:
parent
bc3967ccb6
commit
e7efcee289
|
@ -247,7 +247,7 @@ static void print_measurements(int on)
|
|||
memset(line_color + width - MAX_UNIT_LEN, 4, MAX_UNIT_LEN); /* blue */
|
||||
else
|
||||
memset(line_color + width - MAX_UNIT_LEN, 3, MAX_UNIT_LEN); /* yellow */
|
||||
memcpy(line + width - MAX_UNIT_LEN + 1, text, MAX(strlen(text), MAX_UNIT_LEN));
|
||||
memcpy(line + width - MAX_UNIT_LEN + 1, text, MIN(strlen(text), MAX_UNIT_LEN - 1));
|
||||
display_line(on, width);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue