]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
don't read past end of command line argument
authorMark Andrews <marka@isc.org>
Wed, 30 Apr 2014 06:09:16 +0000 (16:09 +1000)
committerMark Andrews <marka@isc.org>
Wed, 30 Apr 2014 06:09:16 +0000 (16:09 +1000)
bin/dig/dig.c

index b7cd073a6d63994e28d96162ad87d51e977f3afc..295f366262140292ea669631958d0d26ecc9f048 100644 (file)
@@ -1303,16 +1303,22 @@ plus_option(char *option, isc_boolean_t is_batchfile,
                        }
                        break;
                case 't':
-                       switch (cmd[3]) {
-                       case 0:
-                       case 'i': /* ttlid */
-                               FULLCHECK2("ttl", "ttlid");
-                               nottl = ISC_TF(!state);
-                               break;
-                       case 'u': /* ttlunits */
-                               FULLCHECK("ttlunits");
-                               nottl = ISC_FALSE;
-                               ttlunits = ISC_TF(state);
+                       switch (cmd[2]) {
+                       case 'l':
+                               switch (cmd[3]) {
+                               case 0:
+                               case 'i': /* ttlid */
+                                       FULLCHECK2("ttl", "ttlid");
+                                       nottl = ISC_TF(!state);
+                                       break;
+                               case 'u': /* ttlunits */
+                                       FULLCHECK("ttlunits");
+                                       nottl = ISC_FALSE;
+                                       ttlunits = ISC_TF(state);
+                                       break;
+                               default:
+                                       goto invalid_option;
+                               }
                                break;
                        default:
                                goto invalid_option;