diff --git a/cv7/program.c b/cv7/program.c index ce7a8a8..6261790 100644 --- a/cv7/program.c +++ b/cv7/program.c @@ -20,12 +20,12 @@ struct tree* read_tree() { return NULL; } buffer[strcspn(buffer, "\n")] = 0; - struct tree* node = calloc(1, sizeof(struct tree)); - if (buffer[0] == '*') { - if (strlen(buffer) <= 1) { - error_flag = 1; - } + + if (buffer[0] == '*' && buffer[1] == ' ') { + error_flag = 1; // Invalid format if there's a space after '*' } + + struct tree* node = calloc(1, sizeof(struct tree)); strncpy(node->value, buffer, SIZE - 1); return node; }