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>
This commit is contained in:
John Baldwin 2002-10-22 18:44:59 +00:00
parent 11f0df9ed0
commit 12f65109c8

View File

@ -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;
}