mirror of
https://github.com/nmap/nmap.git
synced 2025-12-09 14:11:29 +00:00
Fix some LGTM.com findings related to type widths
This commit is contained in:
@@ -343,7 +343,7 @@ int UDPHeader::setTotalLength(){
|
|||||||
* only carry 65,507 or 65,527. However, we are not taking that into account
|
* only carry 65,507 or 65,527. However, we are not taking that into account
|
||||||
* here because UDP is supposed to be independent of IPv4, IPv6 or
|
* here because UDP is supposed to be independent of IPv4, IPv6 or
|
||||||
* whatever other network layer protocol is used to carry the UDP datagrams.*/
|
* whatever other network layer protocol is used to carry the UDP datagrams.*/
|
||||||
if ((mylen+otherslen) > 65535 || (mylen+otherslen)<8 ){
|
if (otherslen < 0 || otherslen > 65535 || (mylen+otherslen) > 65535){
|
||||||
printf("UDPHeader::setTotalLength(): Invalid length.\n");
|
printf("UDPHeader::setTotalLength(): Invalid length.\n");
|
||||||
return OP_FAILURE;
|
return OP_FAILURE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ static unsigned short *parse_portlist(const char *portlist, unsigned int *count)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assert(*count < 65536);
|
||||||
result = (unsigned short *) malloc(sizeof(*result) * *count);
|
result = (unsigned short *) malloc(sizeof(*result) * *count);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
2
utils.cc
2
utils.cc
@@ -215,7 +215,7 @@ void genfry(unsigned char *arr, int elem_sz, int num_elem) {
|
|||||||
unsigned short *sptr;
|
unsigned short *sptr;
|
||||||
unsigned int *iptr;
|
unsigned int *iptr;
|
||||||
unsigned char *tmp;
|
unsigned char *tmp;
|
||||||
int bpe;
|
size_t bpe;
|
||||||
|
|
||||||
if (sizeof(unsigned char) != 1)
|
if (sizeof(unsigned char) != 1)
|
||||||
fatal("%s() requires 1 byte chars", __func__);
|
fatal("%s() requires 1 byte chars", __func__);
|
||||||
|
|||||||
Reference in New Issue
Block a user