Bug: ax25_getsockopt missing cast

Michael Elizabeth Chastain (mec@duracef.shout.net)
Mon, 11 Nov 1996 09:06:05 -0600


Hello hackers,

I was reading the getsockopt functions and I noticed a missing cast
in ax25_getsockopt (version 2.1.8):

static int ax25_getsockopt(struct socket *sock, int level, int optname,
char *optval, int *optlen)
{
int val = 0;
...
put_user(val, optval);
}

Because optval is a 'char *', this is going to write only one byte into
user space, leaving the other bytes uninitialized. This is probably wrong;
I think this shold be:

put_user(val, (int *) optval);

'atalk_getsockopt' has the same bug. All the other getsockopt's are OK;
they have the cast to (int *).

Michael Chastain
mec@shout.net