diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-01-19 17:49:51 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-01-19 17:49:51 +0000 |
commit | 9f1866c3e0efe0c56d0d5387bcaf845852f74f56 (patch) | |
tree | 0bd0a421a107fe7807489e75b73bbc0f8107df3e | |
parent | ae36f2054b5612aa7968cc0b722e6fd9f0446df1 (diff) |
ENAMETOOLONG if path too long; ok miod pedro
-rw-r--r-- | sys/dev/firmload.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/dev/firmload.c b/sys/dev/firmload.c index fc26a4d7b70..1742d9e56cd 100644 --- a/sys/dev/firmload.c +++ b/sys/dev/firmload.c @@ -1,4 +1,4 @@ -/* $OpenBSD: firmload.c,v 1.6 2006/01/09 18:26:08 pedro Exp $ */ +/* $OpenBSD: firmload.c,v 1.7 2006/01/19 17:49:50 deraadt Exp $ */ /* * Copyright (c) 2004 Theo de Raadt <deraadt@openbsd.org> @@ -46,7 +46,11 @@ loadfirmware(const char *name, u_char **bufp, size_t *buflen) if (path == NULL) return (ENOMEM); - snprintf(path, MAXPATHLEN, "/etc/firmware/%s", name); + if (snprintf(path, MAXPATHLEN, "/etc/firmware/%s", name) >= + MAXPATHLEN) { + error = ENAMETOOLONG; + goto err; + } NDINIT(&nid, LOOKUP, NOFOLLOW|LOCKLEAF, UIO_SYSSPACE, path, p); error = namei(&nid); |