diff --git a/libexec/comsat/comsat.c b/libexec/comsat/comsat.c --- a/libexec/comsat/comsat.c +++ b/libexec/comsat/comsat.c @@ -124,11 +124,9 @@ file = name; else file = cp + 1; - sprintf(buf, "%s/%.*s", _PATH_MAILDIR, (int)sizeof(utp->ut_user), - name); - if (*file != '/') { - sprintf(buf2, "%s/%.*s", _PATH_MAILDIR, - (int)sizeof(utp->ut_user), file); + snprintf(buf, sizeof(buf), "%s/%s", _PATH_MAILDIR, name); + if (strchr(file, '/') == NULL) { + snprintf(buf2, sizeof(buf2), "%s/%s", _PATH_MAILDIR, file); file = buf2; } folder = strcmp(buf, file);