summaryrefslogtreecommitdiffstats
path: root/sys/svr4
diff options
context:
space:
mode:
authornewton <newton@FreeBSD.org>1999-08-14 10:52:33 +0000
committernewton <newton@FreeBSD.org>1999-08-14 10:52:33 +0000
commit5ff2615ae3524707b482556fcc6668d139f2cd67 (patch)
tree4e6ba1388fecb004df1e2c3f8b48fe464cd90957 /sys/svr4
parent4437c70523fc9c569766ece2be5286fccb67b886 (diff)
downloadFreeBSD-src-5ff2615ae3524707b482556fcc6668d139f2cd67.zip
FreeBSD-src-5ff2615ae3524707b482556fcc6668d139f2cd67.tar.gz
Avoid possible panic by checking for EFAULT from copyinstr() during
pathname translation. Submitted by: green
Diffstat (limited to 'sys/svr4')
-rw-r--r--sys/svr4/svr4_util.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/svr4/svr4_util.h b/sys/svr4/svr4_util.h
index abd7b0b..a2f28e3 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_ */
OpenPOWER on IntegriCloud