diff options
author | kris <kris@FreeBSD.org> | 2001-08-20 09:43:04 +0000 |
---|---|---|
committer | kris <kris@FreeBSD.org> | 2001-08-20 09:43:04 +0000 |
commit | 5329ff37f27804cf290f81e20db6c6509183fa4a (patch) | |
tree | 4d579f7484c7b9d591c125acca659924d585e681 /usr.bin | |
parent | 2aca5dc8f686c0848b8f3d5d0e08b22b8a6ed1e7 (diff) | |
download | FreeBSD-src-5329ff37f27804cf290f81e20db6c6509183fa4a.zip FreeBSD-src-5329ff37f27804cf290f81e20db6c6509183fa4a.tar.gz |
Don't overflow a buffer from command line arguments.
MFC after: 2 weeks
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/rpcgen/rpc_main.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/usr.bin/rpcgen/rpc_main.c b/usr.bin/rpcgen/rpc_main.c index 5c0752b..30eb21c 100644 --- a/usr.bin/rpcgen/rpc_main.c +++ b/usr.bin/rpcgen/rpc_main.c @@ -1236,8 +1236,12 @@ parseargs(argc, argv, cmd) if (++i == argc) { return (0); } - (void) strcpy(pathbuf, argv[i]); - (void) strcat(pathbuf, "/cpp"); + (void) strlcpy(pathbuf, argv[i], sizeof(pathbuf)); + if (strlcat(pathbuf, "/cpp", sizeof(pathbuf)) + >= sizeof(pathbuf)) { + warnx("argument too long"); + return (0); + } CPP = pathbuf; cppDefined = 1; goto nextarg; |