From 7a855803b9e47b44443361253da7ecbb9a16eaf5 Mon Sep 17 00:00:00 2001 From: Yaroslav Tykhiy Date: Thu, 14 Jun 2007 14:44:04 +0000 Subject: [PATCH] Fix a typical off-by-one error that can result in an unterminated string: strncpy(dst, src, sizeof(dst)); by substituting the safer strlcpy() for strncpy(). X-Security: none (the source string isn't user-supplied) --- libexec/atrun/atrun.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/atrun/atrun.c b/libexec/atrun/atrun.c index 8a9891c692be..5261c9709bbf 100644 --- a/libexec/atrun/atrun.c +++ b/libexec/atrun/atrun.c @@ -466,7 +466,7 @@ main(int argc, char *argv[]) if ((S_IXUSR & buf.st_mode) && (run_time <=now)) { if (isupper(queue) && (strcmp(batch_name,dirent->d_name) > 0)) { run_batch = 1; - strncpy(batch_name, dirent->d_name, sizeof(batch_name)); + strlcpy(batch_name, dirent->d_name, sizeof(batch_name)); batch_uid = buf.st_uid; batch_gid = buf.st_gid; }