mirror of
https://github.com/nmap/nmap.git
synced 2026-08-04 14:49:29 +00:00
Fix signedness and strncpy truncation warnings
This commit is contained in:
parent
508531ed59
commit
a5b8e61051
5 changed files with 6 additions and 7 deletions
|
|
@ -1401,7 +1401,7 @@ struct tcpopt_info_ctx {
|
|||
bool valid;
|
||||
tcpopt_info_ctx() : p(NULL), end(NULL), valid(true) {}
|
||||
bool check_length(size_t len) const {
|
||||
return (end - p) >= len;
|
||||
return end >= (p + len);
|
||||
}
|
||||
void put_str(const char *str) {
|
||||
if (p >= end)
|
||||
|
|
|
|||
|
|
@ -849,8 +849,7 @@ int EchoHeader::setErrorMessage(const char *err){
|
|||
if(err==NULL){
|
||||
return OP_FAILURE;
|
||||
}else{
|
||||
strncpy((char *)this->data_error->errmsg, err, ERROR_MSG_LEN);
|
||||
this->data_error->errmsg[ERROR_MSG_LEN-1]='\0';
|
||||
Strncpy((char *)this->data_error->errmsg, err, ERROR_MSG_LEN);
|
||||
}
|
||||
return OP_SUCCESS;
|
||||
} /* End of setErrorMessage() */
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ static int lzlib_decompress(lua_State *L)
|
|||
zs.avail_in = avail_in;
|
||||
|
||||
while(decompLimit > 0) {
|
||||
unsigned int bufsize = LUAL_BUFFERSIZE;
|
||||
int bufsize = LUAL_BUFFERSIZE;
|
||||
if (bufsize > decompLimit)
|
||||
bufsize = decompLimit;
|
||||
zs.next_out = (unsigned char*)luaL_prepbuffsize(&b, bufsize);
|
||||
|
|
|
|||
|
|
@ -1996,7 +1996,7 @@ void printosscanoutput(const Target *currenths) {
|
|||
|
||||
if (currenths->seq.responses > 3) {
|
||||
p = numlst;
|
||||
size_t remaining = sizeof(numlst);
|
||||
int remaining = sizeof(numlst);
|
||||
for (i = 0; i < currenths->seq.responses; i++) {
|
||||
int n = Snprintf(p, remaining, "%s%X",
|
||||
(p != numlst) ? "," : "", currenths->seq.seqs[i]);
|
||||
|
|
@ -2020,7 +2020,7 @@ void printosscanoutput(const Target *currenths) {
|
|||
|
||||
if (currenths->seq.responses > 2) {
|
||||
p = numlst;
|
||||
size_t remaining = sizeof(numlst);
|
||||
int remaining = sizeof(numlst);
|
||||
for (i = 0; i < currenths->seq.responses; i++) {
|
||||
int n = Snprintf(p, remaining, "%s%hX",
|
||||
(p != numlst) ? "," : "", currenths->seq.ipids[i]);
|
||||
|
|
|
|||
2
tcpip.cc
2
tcpip.cc
|
|
@ -1121,7 +1121,7 @@ int readtcppacket(const u8 *packet, int readdata) {
|
|||
bullshit2.s_addr = ip->ip_dst.s_addr;
|
||||
realfrag = htons(ntohs(ip->ip_off) & IP_OFFMASK);
|
||||
tot_len = htons(ip->ip_len);
|
||||
strncpy(sourcehost, inet_ntoa(bullshit), 16);
|
||||
Strncpy(sourcehost, inet_ntoa(bullshit), sizeof(sourcehost));
|
||||
if (ip->ip_hl >= 5 && tcp->th_off >= 5) {
|
||||
i = 4 * (ip->ip_hl + tcp->th_off);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue