Merge pull request #39 from Hejsil/fix-buffer-overflows-in-openurl-patch

Fix buffer overflows in openurlonclick.c
This commit is contained in:
Stein Gunnar Bakkeby 2021-08-03 17:51:57 +02:00 committed by GitHub
commit 1fab5f6e4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 3 deletions

View File

@ -46,13 +46,14 @@ openUrlOnClick(int col, int row, char* url_opener)
col_start = 0; col_start = 0;
row_start++; row_start++;
} }
} while (row_start != row_end || col_start != col_end); } while (url_index < (sizeof(url)-1) &&
(row_start != row_end || col_start != col_end));
if (strncmp("http", url, 4) != 0) { if (strncmp("http", url, 4) != 0) {
return; return;
} }
char command[strlen(url_opener)+1+strlen(url)]; char command[strlen(url_opener)+strlen(url)+2];
sprintf(command, "%s %s", url_opener, url); sprintf(command, "%s %s", url_opener, url);
system(command); system(command);
} }