diff --git a/src/smblib/smblib.c b/src/smblib/smblib.c
index f385a04a3bc399fc71f7a6ac360754c70ec17fc0..2698c62f8a319efaf692cbaaacf5102d8ecc3ffb 100644
--- a/src/smblib/smblib.c
+++ b/src/smblib/smblib.c
@@ -1215,7 +1215,7 @@ int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg)
 			,msg->hdr.length, smb_hdrblocks(msg->hdr.length));
 		return(-8);
 	}
-	msg->hdr.length=hdrlen; /* store the actual header length */
+	msg->hdr.length=(ushort)hdrlen; /* store the actual header length */
 
 	/**********************************/
 	/* Set the message header ID here */