diff options
author | Mark Newton <newton@FreeBSD.org> | 1999-08-14 10:52:33 +0000 |
---|---|---|
committer | Mark Newton <newton@FreeBSD.org> | 1999-08-14 10:52:33 +0000 |
commit | 5462f43fb0cc935e2bfee4f28c06ec3d1c71626b (patch) | |
tree | c5c2c5b1270efc64fc17e381f42a0441d3d6b33b /sys | |
parent | 86cfb28d8d175fad35508af791a7333af216a3a2 (diff) | |
download | src-5462f43fb0cc935e2bfee4f28c06ec3d1c71626b.tar.gz src-5462f43fb0cc935e2bfee4f28c06ec3d1c71626b.zip |
Avoid possible panic by checking for EFAULT from copyinstr() during
pathname translation.
Submitted by: green
Notes
Notes:
svn path=/head/; revision=49770
Diffstat (limited to 'sys')
-rw-r--r-- | sys/compat/svr4/svr4_util.h | 17 | ||||
-rw-r--r-- | sys/svr4/svr4_util.h | 17 |
2 files changed, 24 insertions, 10 deletions
diff --git a/sys/compat/svr4/svr4_util.h b/sys/compat/svr4/svr4_util.h index abd7b0b7a184..a2f28e340416 100644 --- a/sys/compat/svr4/svr4_util.h +++ b/sys/compat/svr4/svr4_util.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: svr4_util.h,v 1.2 1999/07/30 12:45:21 newton Exp $ */ #ifndef _SVR4_UTIL_H_ @@ -71,10 +71,17 @@ extern const char svr4_emul_path[]; int svr4_emul_find __P((struct proc *, caddr_t *, const char *, char *, char **, int)); -#define CHECKALTEXIST(p, sgp, path) \ - svr4_emul_find(p, sgp, svr4_emul_path, path, &(path), 0) +#define CHECKALT(p, sgp, path, i) \ + do { \ + int _error; \ + \ + _error = svr4_emul_find(p, sgp, svr4_emul_path, path, \ + &path, i); \ + if (_error == EFAULT) \ + return (_error); \ + } while (0) -#define CHECKALTCREAT(p, sgp, path) \ - svr4_emul_find(p, sgp, svr4_emul_path, path, &(path), 1) +#define CHECKALTEXIST(p, sgp, path) CHECKALT(p, sgp, path, 0) +#define CHECKALTCREAT(p, sgp, path) CHECKALT(p, sgp, path, 1) #endif /* !_SVR4_UTIL_H_ */ diff --git a/sys/svr4/svr4_util.h b/sys/svr4/svr4_util.h index abd7b0b7a184..a2f28e340416 100644 --- a/sys/svr4/svr4_util.h +++ b/sys/svr4/svr4_util.h @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id$ + * $Id: svr4_util.h,v 1.2 1999/07/30 12:45:21 newton Exp $ */ #ifndef _SVR4_UTIL_H_ @@ -71,10 +71,17 @@ extern const char svr4_emul_path[]; int svr4_emul_find __P((struct proc *, caddr_t *, const char *, char *, char **, int)); -#define CHECKALTEXIST(p, sgp, path) \ - svr4_emul_find(p, sgp, svr4_emul_path, path, &(path), 0) +#define CHECKALT(p, sgp, path, i) \ + do { \ + int _error; \ + \ + _error = svr4_emul_find(p, sgp, svr4_emul_path, path, \ + &path, i); \ + if (_error == EFAULT) \ + return (_error); \ + } while (0) -#define CHECKALTCREAT(p, sgp, path) \ - svr4_emul_find(p, sgp, svr4_emul_path, path, &(path), 1) +#define CHECKALTEXIST(p, sgp, path) CHECKALT(p, sgp, path, 0) +#define CHECKALTCREAT(p, sgp, path) CHECKALT(p, sgp, path, 1) #endif /* !_SVR4_UTIL_H_ */ |