Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 05 May 2005 23:53:49 -0600 (MDT)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        gurney_j@resnet.uoregon.edu
Cc:        cperciva@FreeBSD.org
Subject:   Re: cvs commit: src/sys/kern subr_bus.c subr_rman.c vfs_subr.c src/sys/net if_mib.c src/sys/netinet ip_divert.c raw_ip.c udp_usrreq.c
Message-ID:  <20050505.235349.09773936.imp@bsdimp.com>
In-Reply-To: <20050505.232214.96921001.imp@bsdimp.com>
References:  <200505060248.j462mL0k009905@repoman.freebsd.org> <20050506032202.GC2670@funkthat.com> <20050505.232214.96921001.imp@bsdimp.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <20050505.232214.96921001.imp@bsdimp.com>
            "M. Warner Losh" <imp@bsdimp.com> writes:
: : >   If we are going to
: : >   1. Copy a NULL-terminated string into a fixed-length buffer, and
: : >   2. copyout that buffer to userland,
: : >   we really ought to
: : >   0. Zero the entire buffer
: : >   first.
: : >   
: : >   Security: FreeBSD-SA-05:08.kmem
: : 
: : /me notes this is a good reason to use strncpy instead of strlcpy.
: 
: Don't you mean the opposite?

Actually, in at least one of these cases that were fixed should be
fixed by allocating the structure M_ZERO because it is a little too
large for the stack anyway.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050505.235349.09773936.imp>