diff --git a/src/global.c b/src/global.c index 3c6141a6a0adfd4c788dd830952bcea18ae48b7f..4c9f56c83a2147ddae36100579f2f963dc25d2e1 100644 --- a/src/global.c +++ b/src/global.c @@ -614,7 +614,7 @@ void qh_initflags(char *command) { if (command <= &qh qhull_command[0] || command > &qh qhull_command[0] + sizeof(qh qhull_command)) { if (command != &qh qhull_command[0]) { *qh qhull_command= '\0'; - strncat( qh qhull_command, command, sizeof( qh qhull_command)); + strncat(qh qhull_command, command, sizeof(qh qhull_command)-strlen(qh qhull_command)-1); } while (*s && !isspace(*s)) /* skip program name */ s++; diff --git a/src/rboxlib.c b/src/rboxlib.c index 4f11d22727c2779ef804448c9cfcd9e1221b6868..17d01ac3d8ab847aa56de684fb98ddbac4a0b26e 100644 --- a/src/rboxlib.c +++ b/src/rboxlib.c @@ -124,7 +124,7 @@ int qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command) { } *command= '\0'; - strncat(command, rbox_command, sizeof(command)); + strncat(command, rbox_command, sizeof(command)-strlen(command)-1); while (*s && !isspace(*s)) /* skip program name */ s++; @@ -346,8 +346,8 @@ int qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command) { } }else if (israndom) { seed= (int)time(&timedata); - sprintf(seedbuf, " t%d", seed); /* appends an extra t, not worth removing */ - strncat(command, seedbuf, sizeof(command)); + printf(seedbuf, " t%d", seed); /* appends an extra t, not worth removing */ + strncat(command, seedbuf, sizeof(command)-strlen(command)-1); t= strstr(command, " t "); if (t) strcpy(t+1, t+3); /* remove " t " */