diff options
author | peter <peter@FreeBSD.org> | 2000-07-18 06:08:27 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2000-07-18 06:08:27 +0000 |
commit | bf473790e8e393671834d726eb6fa54b64952a0f (patch) | |
tree | 404593f3c1ba5f11831f2652be56c420c727ef42 /sys/kern | |
parent | 94d46e7245fe676507c507a39b94cc6e10f076d3 (diff) | |
download | FreeBSD-src-bf473790e8e393671834d726eb6fa54b64952a0f.zip FreeBSD-src-bf473790e8e393671834d726eb6fa54b64952a0f.tar.gz |
Patch up some bogons in the resource_find() vs resource_find_hard()
interfaces. The original resource_find() returned a pointer to an internal
resource table entry. resource_find_hard() dereferences the actual
passed in value (oops!) - effectively trashing random memory due to
the pointer being passed in with a random initial value.
Submitted by: bde
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_bus.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 4417b23..187995e 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -1388,9 +1388,11 @@ resource_find(const char *name, int unit, const char *resname, int resource_int_value(const char *name, int unit, const char *resname, int *result) { - int error; + struct config_resource tmpres; struct config_resource *res; + int error; + res = &tmpres; if ((error = resource_find(name, unit, resname, &res)) != 0) return error; if (res->type != RES_INT) @@ -1403,9 +1405,11 @@ int resource_long_value(const char *name, int unit, const char *resname, long *result) { - int error; + struct config_resource tmpres; struct config_resource *res; + int error; + res = &tmpres; if ((error = resource_find(name, unit, resname, &res)) != 0) return error; if (res->type != RES_LONG) @@ -1418,9 +1422,11 @@ int resource_string_value(const char *name, int unit, const char *resname, char **result) { - int error; + struct config_resource tmpres; struct config_resource *res; + int error; + res = &tmpres; if ((error = resource_find(name, unit, resname, &res)) != 0) return error; if (res->type != RES_STRING) |