diff -urN installwatch-0.6.3.ori/installwatch.c installwatch-0.6.3/installwatch.c --- installwatch-0.6.3.ori/installwatch.c 2004-08-30 14:47:35.917768321 +0000 +++ installwatch-0.6.3/installwatch.c 2004-08-30 14:51:30.568600728 +0000 @@ -142,11 +142,17 @@ va_start(ap, format); count = vsnprintf(buffer, BUFSIZE, format, ap); va_end(ap); + + buffer [BUFSIZE - 2] = '\n'; + buffer [BUFSIZE - 1] = 0; + if(count == -1) { /* The buffer was not big enough */ strcpy(&(buffer[BUFSIZE - 5]), "...\n"); count = BUFSIZE - 1; - } + } else { + count = strlen(buffer); + } if((logname = getenv("INSTALLWATCHFILE"))) { logfd = true_open(logname, O_WRONLY | O_CREAT | O_APPEND, 0666); if(logfd >= 0) { @@ -179,8 +185,9 @@ * to the current working directory if it was not * an absolute path */ getcwd(resolved_path, MAXPATHLEN - 2); + resolved_path[MAXPATHLEN - 2] = 0; strcat(resolved_path, "/"); - strncat(resolved_path, path, MAXPATHLEN - 1); + strncat(resolved_path, path, MAXPATHLEN - 1 - strlen(resolved_path)); } errno = s_errno;