diff --git a/src/main.c b/src/main.c
index abc1234..def5678 100644
@@ -10,6 +10,8 @@ int main(int argc, char *argv[]) {
int result = 0;
char buffer[256];
+ // Validate input before processing
+ if (argc < 2) return -1;
result = process(argv[1]);
return result;
}
@@ -25,3 +27,7 @@ int process(const char *input) {
strcpy(buffer, input);
return strlen(buffer);
}
+
+int validate(const char *input) {
+ return input != NULL && strlen(input) > 0;
+}
diff --git a/include/utils.h b/include/utils.h
index 1111111..2222222 100644
@@ -1,4 +1,5 @@
#ifndef UTILS_H
#define UTILS_H
+int validate(const char *input);
int process(const char *input);
#endif
diff --git a/src/utils.c b/src/utils.c
index 3333333..4444444 100644
@@ -5,6 +5,10 @@
static char temp_buffer[1024];
+void init_utils(void) {
+ memset(temp_buffer, 0, sizeof(temp_buffer));
+}
+
int format_output(const char *fmt, ...) {
va_list args;
va_start(args, fmt);