Skip to content

Commit 03f37c0

Browse files
committed
tesseractmain: Fix unterminated string
Coverity bug report: CID 1270421 "Buffer not null terminated". Signed-off-by: Stefan Weil <[email protected]>
1 parent 9c13a15 commit 03f37c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api/tesseractmain.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,11 @@ int main(int argc, char **argv) {
186186
exit(1);
187187
}
188188

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

0 commit comments

Comments
 (0)