aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKris Kennaway <kris@FreeBSD.org>2000-08-04 11:15:48 +0000
committerKris Kennaway <kris@FreeBSD.org>2000-08-04 11:15:48 +0000
commit9c9c8212ca275e51b6dbd2405a22a6e6909e0158 (patch)
treea912c295d0dbb0c10603d8af4709dd19a47ec1a8 /lib
parent63c21920f93a0d5cb16a7b3536427e7579761c82 (diff)
downloadsrc-9c9c8212ca275e51b6dbd2405a22a6e6909e0158.tar.gz
src-9c9c8212ca275e51b6dbd2405a22a6e6909e0158.zip
Return an error instead of overflowing the buffer in the case of a long
$HOME in ruserpass()
Notes
Notes: svn path=/head/; revision=64243
Diffstat (limited to 'lib')
-rw-r--r--lib/libcompat/4.3/rexec.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libcompat/4.3/rexec.c b/lib/libcompat/4.3/rexec.c
index beb210832993..2fc85dad9b84 100644
--- a/lib/libcompat/4.3/rexec.c
+++ b/lib/libcompat/4.3/rexec.c
@@ -29,6 +29,8 @@
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -146,6 +148,8 @@ ruserpass(host, aname, apass, aacct)
hdir = getenv("HOME");
if (hdir == NULL)
hdir = ".";
+ if (strlen(hdir) + 8 > sizeof(buf))
+ return (0);
(void) sprintf(buf, "%s/.netrc", hdir);
cfile = fopen(buf, "r");
if (cfile == NULL) {