This is probably more appropriate here. mph
Begin forwarded message: Date: Wed, 18 Jul 2007 18:40:49 -0700 From: Michael Hunter <michael.hun...@sun.com> To: clearview-discuss at opensolaris.org Cc: Renee.Danson at Sun.COM Subject: [clearview-discuss] lantent string termination bug In wpa_config_parse_ssid() ssid is set to the strdup(value) and ssid_len is set to the strlen(value). ssid_len is checked to be <= MAX_ESSID_LENGTH. I think that should probably be < so you can fit in the termination or the constant should be renamed. I don't see an obvious place where this is an issue around this code but I'm not convinced that it is easy for the reader to figure out what your conventions are (although there are clearly some +1s around that make the above work). FWIW I tend to use max to mean the max of the value and len to mean the length (amount) of storage including termination, quoteing, etc. But in any case what convention you choose is up to you although it should really be chosen to make the readers job easier. In dladm_wlan_wpa_get_sr() you memcpy(we_bytes, ssid, ssid_len) which just happens to work because the array is set to 0 by the caller although I don't see that being stated explictly. You should state that this is the assumption somewhere close by or terminate the strings. No bugs here I think but maybe it would be worthwhile to play a little slower with strings. In wpa_supplicant.c:117 should this this be isprint() or is the ssid us ascii centric? Should the replacement character depend on locale? FWIW I was looking at this code 'cuz we had a bug where we were formatting up some wireless information and passing it through popen() and the shell was interpreting embedded quotes in a way quite unhealthy. So that bug is our fault, but looking at your code it wasn't immediately obvious to me that it was entirely copasetic. mph _________________________________ clearview-discuss mailing list clearview-discuss at opensolaris.org