mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 16:15:27 +00:00
Don't crash if someone specifies an option (like -f) to dig without its
argument.
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
* SOFTWARE.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: dig.c,v 1.77 2000/07/24 23:13:44 mws Exp $ */
|
/* $Id: dig.c,v 1.78 2000/07/25 00:51:14 mws Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -836,6 +836,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
if (rv[0][2] != 0) {
|
if (rv[0][2] != 0) {
|
||||||
ptr = &rv[0][2];
|
ptr = &rv[0][2];
|
||||||
} else {
|
} else {
|
||||||
|
if (rc <= 1) {
|
||||||
|
show_usage();
|
||||||
|
exit (exitcode);
|
||||||
|
}
|
||||||
ptr = rv[1];
|
ptr = rv[1];
|
||||||
rv++;
|
rv++;
|
||||||
rc--;
|
rc--;
|
||||||
@@ -854,6 +858,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
if (rv[0][2] != 0) {
|
if (rv[0][2] != 0) {
|
||||||
ptr = &rv[0][2];
|
ptr = &rv[0][2];
|
||||||
} else {
|
} else {
|
||||||
|
if (rc <= 1) {
|
||||||
|
show_usage();
|
||||||
|
exit (exitcode);
|
||||||
|
}
|
||||||
ptr = rv[1];
|
ptr = rv[1];
|
||||||
rv++;
|
rv++;
|
||||||
rc--;
|
rc--;
|
||||||
@@ -879,6 +887,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
if (rv[0][2] != 0) {
|
if (rv[0][2] != 0) {
|
||||||
batchname = &rv[0][2];
|
batchname = &rv[0][2];
|
||||||
} else {
|
} else {
|
||||||
|
if (rc <= 1) {
|
||||||
|
show_usage();
|
||||||
|
exit (exitcode);
|
||||||
|
}
|
||||||
batchname = rv[1];
|
batchname = rv[1];
|
||||||
rv++;
|
rv++;
|
||||||
rc--;
|
rc--;
|
||||||
@@ -887,6 +899,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
if (rv[0][2] != 0)
|
if (rv[0][2] != 0)
|
||||||
ptr = &rv[0][2];
|
ptr = &rv[0][2];
|
||||||
else {
|
else {
|
||||||
|
if (rc <= 1) {
|
||||||
|
show_usage();
|
||||||
|
exit (exitcode);
|
||||||
|
}
|
||||||
ptr = rv[1];
|
ptr = rv[1];
|
||||||
rv++;
|
rv++;
|
||||||
rc--;
|
rc--;
|
||||||
@@ -907,6 +923,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
if (rv[0][2] != 0)
|
if (rv[0][2] != 0)
|
||||||
ptr = &rv[0][2];
|
ptr = &rv[0][2];
|
||||||
else {
|
else {
|
||||||
|
if (rc <= 1) {
|
||||||
|
show_usage();
|
||||||
|
exit (exitcode);
|
||||||
|
}
|
||||||
ptr = rv[1];
|
ptr = rv[1];
|
||||||
rv++;
|
rv++;
|
||||||
rc--;
|
rc--;
|
||||||
@@ -916,6 +936,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
if (rv[0][2] != 0) {
|
if (rv[0][2] != 0) {
|
||||||
port = atoi(&rv[0][2]);
|
port = atoi(&rv[0][2]);
|
||||||
} else {
|
} else {
|
||||||
|
if (rc <= 1) {
|
||||||
|
show_usage();
|
||||||
|
exit (exitcode);
|
||||||
|
}
|
||||||
port = atoi(rv[1]);
|
port = atoi(rv[1]);
|
||||||
rv++;
|
rv++;
|
||||||
rc--;
|
rc--;
|
||||||
@@ -925,6 +949,10 @@ parse_args(isc_boolean_t is_batchfile, isc_boolean_t config_only,
|
|||||||
strncpy(address, &rv[0][2],
|
strncpy(address, &rv[0][2],
|
||||||
MXRD);
|
MXRD);
|
||||||
} else {
|
} else {
|
||||||
|
if (rc <= 1) {
|
||||||
|
show_usage();
|
||||||
|
exit (exitcode);
|
||||||
|
}
|
||||||
strncpy(address, rv[1],
|
strncpy(address, rv[1],
|
||||||
MXRD);
|
MXRD);
|
||||||
rv++;
|
rv++;
|
||||||
|
Reference in New Issue
Block a user