diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2007-08-10 14:25:09 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2007-08-10 14:25:09 +0000 |
commit | 30f45c0506da7e29f849ea7cedbc8011157659ff (patch) | |
tree | 34b0e25a98fe54d372583656db9f5a33cf11ef78 /sys/arch/sparc64 | |
parent | 1b0b973148d1353611666040af99327b192eac3f (diff) |
Be more careful when asking for the next property. help and ok kettenis@.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/sparc64/openprom.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/openprom.c b/sys/arch/sparc64/sparc64/openprom.c index 4a27b820dbb..1271fa882d4 100644 --- a/sys/arch/sparc64/sparc64/openprom.c +++ b/sys/arch/sparc64/sparc64/openprom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: openprom.c,v 1.11 2003/06/02 23:27:56 millert Exp $ */ +/* $OpenBSD: openprom.c,v 1.12 2007/08/10 14:25:08 fgsch Exp $ */ /* $NetBSD: openprom.c,v 1.4 2002/01/10 06:21:53 briggs Exp $ */ /* @@ -57,6 +57,8 @@ #include <dev/ofw/openfirm.h> +#define OPROMMAXPARAM 32 + static int lastnode; /* speed hack */ extern int optionsnode; /* node ID of ROM's options */ @@ -205,7 +207,11 @@ openpromioctl(dev, cmd, data, flags, p) error = openpromgetstr(op->op_namelen, op->op_name, &name); if (error) break; - value = nextprop = malloc(op->op_buflen, M_TEMP, M_WAITOK); + if (op->op_buflen <= 0) { + error = ENAMETOOLONG; + break; + } + value = nextprop = malloc(OPROMMAXPARAM, M_TEMP, M_WAITOK); if (nextprop == NULL) { error = ENOMEM; break; |