Skip to content

Commit 805fd42

Browse files
committed
BOOTP: Use an uint16_t variable to get the result of a GET_BE_U_2()
This will fix this Visual Studio warning: print-bootp.c(1009,18): warning C4242: =: conversion from uint16_t to uint8_t, possible loss of data
1 parent b1e5b9e commit 805fd42

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

print-bootp.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,22 +1006,24 @@ rfc1048_print(netdissect_options *ndo,
10061006
* URI: URI of the SZTP bootstrap server.
10071007
*/
10081008
while (len >= 2) {
1009-
suboptlen = GET_BE_U_2(bp);
1009+
uint16_t suboptlen2;
1010+
1011+
suboptlen2 = GET_BE_U_2(bp);
10101012
bp += 2;
10111013
len -= 2;
10121014
ND_PRINT("\n\t ");
1013-
ND_PRINT("length %u: ", suboptlen);
1014-
if (len < suboptlen) {
1015+
ND_PRINT("length %u: ", suboptlen2);
1016+
if (len < suboptlen2) {
10151017
ND_PRINT("length goes past end of option");
10161018
bp += len;
10171019
len = 0;
10181020
break;
10191021
}
10201022
ND_PRINT("\"");
1021-
nd_printjn(ndo, bp, suboptlen);
1023+
nd_printjn(ndo, bp, suboptlen2);
10221024
ND_PRINT("\"");
1023-
len -= suboptlen;
1024-
bp += suboptlen;
1025+
len -= suboptlen2;
1026+
bp += suboptlen2;
10251027
}
10261028
if (len != 0) {
10271029
ND_PRINT("[ERROR: length < 2 bytes]");

0 commit comments

Comments
 (0)