]> git.proxmox.com Git - mirror_zfs.git/commit - cmd/ztest/ztest.c
Realpath arg 2 must be a minimum of PATH_MAX
authorBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 4 Oct 2012 19:54:47 +0000 (12:54 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 4 Oct 2012 20:19:10 +0000 (13:19 -0700)
commitae380cfa76e4d61bc6373b6b4e97bc3cac0a3a6e
treed71b3e5464c6948fc99b263f273448f3e6b2842f
parent5be98cfe2fd81145c9c16ddbe3b4d7d52f687157
Realpath arg 2 must be a minimum of PATH_MAX

The realpath(3) function expects that when a buffer is passed
for the 'resolved_path' that it be at least PATH_MAX in length.
If it's not a buffer overflow may occur.

Therefore the passed buffer size is changed from MAXNAMELEN to
MAXPATHLEN.  We also take this opertunity to dynamically allocate
the buffer to keep it off the stack.

  warning: call to '__realpath_chk_warn' declared with attribute
  warning: second argument of realpath must be either NULL or at
  least PATH_MAX bytes long buffer [enabled by default]

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
cmd/ztest/ztest.c