From 2f5c70b2b0f0fbdc1d0afcc2e148bc3e167ac6c7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Thu, 11 Dec 2014 09:15:04 +0100 Subject: [PATCH] telnet: fix "cast increases required alignment of target type" --- lib/telnet.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/telnet.c b/lib/telnet.c index b0f72ab0a8dfcb..176e9940b7e867 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -710,7 +710,6 @@ static void printsub(struct SessionHandle *data, size_t length) /* length of suboption data */ { unsigned int i = 0; - unsigned short *pval; if(data->set.verbose) { if(direction) { @@ -763,9 +762,9 @@ static void printsub(struct SessionHandle *data, switch(pointer[0]) { case CURL_TELOPT_NAWS: - pval = (unsigned short*)(pointer+1); - infof(data, "Width: %hu ; Height: %hu", - ntohs(pval[0]), ntohs(pval[1])); + if(length > 4) + infof(data, "Width: %hu ; Height: %hu", (pointer[1]<<8) | pointer[2], + (pointer[3]<<8) | pointer[4]); break; default: switch(pointer[1]) {