[PATCH 7/7] wpa_supplicant: fix null dereference in ieee802_1x_get_mib_sta()

Peer, Ilan ilan.peer
Mon Feb 10 04:32:14 PST 2014


> -----Original Message-----
> From: Johannes Berg [mailto:johannes at sipsolutions.net]
> Sent: Monday, February 10, 2014 13:55
> To: Holger Schurig
> Cc: Peer, Ilan; Lifshitz, Eytan; hostap at lists.shmoo.com
> Subject: Re: [PATCH 7/7] wpa_supplicant: fix null dereference in
> ieee802_1x_get_mib_sta()
> 
> On Mon, 2014-02-10 at 12:44 +0100, Holger Schurig wrote:
> > Hmm, isn't it allowed to pass NULL to the %s format specifier of
> > printf/snprintf and friends?  Or is it a GCC feature that it prints
> > the string "(null)" then?  That is perfectly "valgrind-clean".
> 
> I was wondering the same, but POSIX (man 3p printf, if you have it
> installed) doesn't seem to talk about passing NULL to %s.
> 

Quotation from: http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf about the s modifier:

"If no l length modi?er is present, the argument shall be a pointer to the initial element of an array of character type. Characters from the array are written up to (but not including) the terminating null character ..."

As far as I understand the above, passing the NULL pointer is not valid ...

Regards,

Ilan.





More information about the Hostap mailing list