mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 11:02:44 +00:00
Return an error instead of overflowing the buffer in the case of a long
$HOME in ruserpass()
This commit is contained in:
parent
63c21920f9
commit
9c9c8212ca
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=64243
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user