Prevented a quite unlikely buffer overflow by argument. Coverity CID 21831.

This commit is contained in:
Thomas Schmitt 2015-10-28 19:59:58 +00:00
parent d32dbe37fe
commit ef662655bb

View File

@ -800,6 +800,13 @@ int telltoc_setup(int argc, char **argv)
{ {
int i; int i;
for (i = 1; i < argc; ++i) {
if (strlen(argv[i]) >= 4096) {
fprintf(stderr,
"Argument at position %d is much too long. (Max 4095)\n", i);
return 2;
}
}
for (i = 1; i < argc; ++i) { for (i = 1; i < argc; ++i) {
if (!strcmp(argv[i], "--drive")) { if (!strcmp(argv[i], "--drive")) {
++i; ++i;