Fix some byte ordering problems; I was storing string lengths wrong,

which was causing wicontrol to crash when reading string parameters
from the WaveLAN.

Patches submitted by: Brad Karp <karp@eecs.harvard.edu>
This commit is contained in:
wpaul 1999-05-06 03:34:02 +00:00
parent 78c2183cb6
commit 7d2d27f237
3 changed files with 8 additions and 8 deletions

View File

@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: if_wireg.h,v 1.28 1999/05/03 18:34:16 wpaul Exp $
* $Id: if_wireg.h,v 1.29 1999/05/06 03:05:48 wpaul Exp $
*/
struct wi_counters {
@ -330,7 +330,7 @@ struct wi_ltv_str {
bzero((char *)&s, sizeof(s)); \
s.wi_len = (l / 2) + 2; \
s.wi_type = recno; \
s.wi_str[0] = htons(strlen(str)); \
s.wi_str[0] = strlen(str); \
bcopy(str, (char *)&s.wi_str[1], strlen(str)); \
wi_write_record(sc, (struct wi_ltv_gen *)&s); \
} while (0)

View File

@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: if_wireg.h,v 1.28 1999/05/03 18:34:16 wpaul Exp $
* $Id: if_wireg.h,v 1.29 1999/05/06 03:05:48 wpaul Exp $
*/
struct wi_counters {
@ -330,7 +330,7 @@ struct wi_ltv_str {
bzero((char *)&s, sizeof(s)); \
s.wi_len = (l / 2) + 2; \
s.wi_type = recno; \
s.wi_str[0] = htons(strlen(str)); \
s.wi_str[0] = strlen(str); \
bcopy(str, (char *)&s.wi_str[1], strlen(str)); \
wi_write_record(sc, (struct wi_ltv_gen *)&s); \
} while (0)

View File

@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: wicontrol.c,v 1.14 1999/05/05 01:33:16 wpaul Exp $
* $Id: wicontrol.c,v 1.15 1999/05/06 03:05:48 wpaul Exp $
*/
#include <sys/types.h>
@ -56,7 +56,7 @@
static const char copyright[] = "@(#) Copyright (c) 1997, 1998, 1999\
Bill Paul. All rights reserved.";
static const char rcsid[] =
"@(#) $Id: wicontrol.c,v 1.14 1999/05/05 01:33:16 wpaul Exp $";
"@(#) $Id: wicontrol.c,v 1.15 1999/05/06 03:05:48 wpaul Exp $";
#endif
static void wi_getval __P((char *, struct wi_req *));
@ -136,7 +136,7 @@ void wi_printstr(wreq)
}
} else {
ptr = (char *)&wreq->wi_val[1];
for (i = 0; i < ntohs(wreq->wi_val[0]); i++) {
for (i = 0; i < wreq->wi_val[0]; i++) {
if (ptr[i] == '\0')
ptr[i] = ' ';
}
@ -168,7 +168,7 @@ void wi_setstr(iface, code, str)
wreq.wi_type = code;
wreq.wi_len = 18;
wreq.wi_val[0] = htons(strlen(str));
wreq.wi_val[0] = strlen(str);
bcopy(str, (char *)&wreq.wi_val[1], strlen(str));
wi_setval(iface, &wreq);