Merge pull request #3608 from clayton-shopify/fix-mirb-off-by-one

Fix an off-by-one causing a buffer overflow in mirb.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-04-14 07:07:52 +09:00
committed by GitHub
+1 -1
View File
@@ -442,7 +442,7 @@ main(int argc, char **argv)
char_index = 0;
while ((last_char = getchar()) != '\n') {
if (last_char == EOF) break;
if (char_index > sizeof(last_code_line)-2) {
if (char_index >= sizeof(last_code_line)-2) {
fputs("input string too long\n", stderr);
continue;
}