- cerrmsg = malloc(MSGSIZE + 1);
- if(val != NULL) {
- strcpy(cerrmsg, val);
- strcat(cerrmsg, ": ");
- strcat(cerrmsg, getcerrmsg(cerrno));
+ cerrmsg = malloc(CERRMSGSIZE + 1);
+ if(str != NULL && strlen(str) < 10) {
+ sprintf(cerrmsg, "%s: %s", str, getcerrmsg(cerrno));