Skip to content

Commit

Permalink
tesseractmain: Fix unterminated string
Browse files Browse the repository at this point in the history
Coverity bug report: CID 1270421 "Buffer not null terminated".

Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Nov 24, 2015
1 parent 9c13a15 commit 03f37c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion api/tesseractmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,11 @@ int main(int argc, char **argv) {
exit(1);
}

char opt1[255], opt2[255];
char opt1[256], opt2[255];
for (arg = 0; arg < argc; arg++) {
if (strcmp(argv[arg], "-c") == 0 && arg + 1 < argc) {
strncpy(opt1, argv[arg + 1], 255);
opt1[255] = '\0';
char *p = strchr(opt1, '=');
if (!p) {
fprintf(stderr, "Missing = in configvar assignment\n");
Expand Down

0 comments on commit 03f37c0

Please sign in to comment.