We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9ac6097 commit 6cc213dCopy full SHA for 6cc213d
1 file changed
src/clu_main.c
@@ -401,11 +401,16 @@ int clu_entry(const void* argument)
401
}
402
403
404
+ if (argc > MAX_COMMAND_ARGS) {
405
+ WOLFCLU_LOG(WOLFCLU_L0, "Too many arguments (max %d)", MAX_COMMAND_ARGS);
406
+ return -1;
407
+ }
408
+
409
i = 0;
410
token = strtok(command, " ");
411
412
/* split the command string to correspond to separate argv[i] */
- while (token != NULL && i <= MAX_COMMAND_ARGS) {
413
+ while (token != NULL && i < argc) {
414
argv[i] = XMALLOC(XSTRLEN(token)+1, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
415
XMEMSET(argv[i], 0, XSTRLEN(token)+1);
416
XSTRNCPY(argv[i], token, XSTRLEN(token));
0 commit comments