]> granicus.if.org Git - curl/commitdiff
telnet: fix "cast increases required alignment of target type"
authorDaniel Stenberg <daniel@haxx.se>
Thu, 11 Dec 2014 08:15:04 +0000 (09:15 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 11 Dec 2014 08:15:04 +0000 (09:15 +0100)
lib/telnet.c

index b0f72ab0a8dfcb5badfb7cb9af3f8086ae399a09..176e9940b7e8671010e8557325fddb9262cb56dc 100644 (file)
@@ -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]) {