diff options
author | yar <yar@FreeBSD.org> | 2007-06-14 14:44:04 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2007-06-14 14:44:04 +0000 |
commit | aaa29dd12ae9d1a8013f51a69f3eda7539141a6f (patch) | |
tree | 1ab4b40bf9fdf4f4f171359976d2253b60d532e5 /libexec/atrun/atrun.c | |
parent | 25b7a16e23d0a9e488fddf3d4bfe804f3e06ab93 (diff) | |
download | FreeBSD-src-aaa29dd12ae9d1a8013f51a69f3eda7539141a6f.zip FreeBSD-src-aaa29dd12ae9d1a8013f51a69f3eda7539141a6f.tar.gz |
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)
Diffstat (limited to 'libexec/atrun/atrun.c')
-rw-r--r-- | libexec/atrun/atrun.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libexec/atrun/atrun.c b/libexec/atrun/atrun.c index 8a9891c..5261c97 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; } |