diff options
author | jhb <jhb@FreeBSD.org> | 2002-10-22 18:44:59 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2002-10-22 18:44:59 +0000 |
commit | 1cc1792ab55023f60a34b8cc215b93481df7fa23 (patch) | |
tree | 1034b44c94dfc283e537caf97cbf0f3f7ceb42f6 /sys/kern | |
parent | d6241fec61d87f5eddfed97983220922523ae3ed (diff) | |
download | FreeBSD-src-1cc1792ab55023f60a34b8cc215b93481df7fa23.zip FreeBSD-src-1cc1792ab55023f60a34b8cc215b93481df7fa23.tar.gz |
Don't dereference the 'x' pointer if it is NULL, instead skip the
assignment. The netsmb code likes to call these functions with a NULL
x argument a lot.
Reported by: Vallo Kallaste <kalts@estpak.ee>
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/subr_mchain.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sys/kern/subr_mchain.c b/sys/kern/subr_mchain.c index cb15ff7..b63a12e 100644 --- a/sys/kern/subr_mchain.c +++ b/sys/kern/subr_mchain.c @@ -376,7 +376,8 @@ md_get_uint16le(struct mdchain *mdp, u_int16_t *x) u_int16_t v; int error = md_get_uint16(mdp, &v); - *x = letohs(v); + if (x != NULL) + *x = letohs(v); return error; } @@ -385,7 +386,8 @@ md_get_uint16be(struct mdchain *mdp, u_int16_t *x) { u_int16_t v; int error = md_get_uint16(mdp, &v); - *x = betohs(v); + if (x != NULL) + *x = betohs(v); return error; } @@ -402,7 +404,8 @@ md_get_uint32be(struct mdchain *mdp, u_int32_t *x) int error; error = md_get_uint32(mdp, &v); - *x = betohl(v); + if (x != NULL) + *x = betohl(v); return error; } @@ -413,7 +416,8 @@ md_get_uint32le(struct mdchain *mdp, u_int32_t *x) int error; error = md_get_uint32(mdp, &v); - *x = letohl(v); + if (x != NULL) + *x = letohl(v); return error; } @@ -430,7 +434,8 @@ md_get_int64be(struct mdchain *mdp, int64_t *x) int error; error = md_get_int64(mdp, &v); - *x = betohq(v); + if (x != NULL) + *x = betohq(v); return error; } @@ -441,7 +446,8 @@ md_get_int64le(struct mdchain *mdp, int64_t *x) int error; error = md_get_int64(mdp, &v); - *x = letohq(v); + if (x != NULL) + *x = letohq(v); return error; } |