src/main-executable/main.c: fix possible stray : at the end of classpath

apparently this can cause a crash in art
This commit is contained in:
Mis012
2023-06-21 18:33:30 +02:00
parent 1a8e198e05
commit 55098136dc

View File

@@ -59,12 +59,14 @@ char *construct_classpath(char *prefix, char **cp_array, size_t len)
strcpy(result, prefix); strcpy(result, prefix);
for(int i = 0; i < len; i++) { for(int i = 0; i < len; i++) {
if(cp_array[i]) { if(cp_array[i]) {
strcat(result, cp_array[i]); if (i > 0)
if (i < (len - 1))
strcat(result, ":"); strcat(result, ":");
strcat(result, cp_array[i]);
} }
} }
printf("construct_classpath: returning >%s<\n", result);
return result; return result;
} }