mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-11 23:19:04 +08:00
tesseractmain: Fix unterminated string
Coverity bug report: CID 1270421 "Buffer not null terminated". Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
af9212c459
commit
8c4b027292
@ -186,10 +186,11 @@ int main(int argc, char **argv) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char opt1[255], opt2[255];
|
char opt1[256], opt2[255];
|
||||||
for (arg = 0; arg < argc; arg++) {
|
for (arg = 0; arg < argc; arg++) {
|
||||||
if (strcmp(argv[arg], "-c") == 0 && arg + 1 < argc) {
|
if (strcmp(argv[arg], "-c") == 0 && arg + 1 < argc) {
|
||||||
strncpy(opt1, argv[arg + 1], 255);
|
strncpy(opt1, argv[arg + 1], 255);
|
||||||
|
opt1[255] = '\0';
|
||||||
char *p = strchr(opt1, '=');
|
char *p = strchr(opt1, '=');
|
||||||
if (!p) {
|
if (!p) {
|
||||||
fprintf(stderr, "Missing = in configvar assignment\n");
|
fprintf(stderr, "Missing = in configvar assignment\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user