summaryrefslogtreecommitdiff
path: root/tests/dtls/dtls-stress.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dtls/dtls-stress.c')
-rw-r--r--tests/dtls/dtls-stress.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/dtls/dtls-stress.c b/tests/dtls/dtls-stress.c
index 93f904e290..1b70605c66 100644
--- a/tests/dtls/dtls-stress.c
+++ b/tests/dtls/dtls-stress.c
@@ -1179,10 +1179,14 @@ int main(int argc, const char *argv[])
batch = 1;
} else if (strcmp("-d", argv[arg]) == 0) {
char *end;
- int level = strtol(argv[arg + 1], &end, 10);
- if (*end == '\0') {
- debug = level;
- arg++;
+ int level;
+
+ if (arg+1 < argc) {
+ level = strtol(argv[arg + 1], &end, 10);
+ if (*end == '\0') {
+ debug = level;
+ arg++;
+ }
} else {
debug++;
}