mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-01-18 10:46:23 +00:00
Fix un/signed comparison warning (error)
This commit is contained in:
parent
866631c525
commit
2aa3b85440
@ -97,18 +97,19 @@ static int add_record(int mdp_sockfd){
|
|||||||
uint8_t payload[MDP_MTU];
|
uint8_t payload[MDP_MTU];
|
||||||
|
|
||||||
ssize_t len = mdp_recv(mdp_sockfd, &header, payload, sizeof payload);
|
ssize_t len = mdp_recv(mdp_sockfd, &header, payload, sizeof payload);
|
||||||
if (len==-1)
|
if (len == -1)
|
||||||
return WHY_perror("mdp_recv");
|
return WHY_perror("mdp_recv");
|
||||||
|
|
||||||
if (header.flags & (MDP_FLAG_NO_CRYPT|MDP_FLAG_NO_SIGN))
|
if (header.flags & (MDP_FLAG_NO_CRYPT|MDP_FLAG_NO_SIGN))
|
||||||
return WHY("Only encrypted packets will be considered for publishing\n");
|
return WHY("Only encrypted packets will be considered for publishing\n");
|
||||||
|
|
||||||
// make sure the payload is a NULL terminated string
|
// make sure the payload is a NULL terminated string
|
||||||
payload[len]=0;
|
assert((size_t)len < sizeof payload);
|
||||||
|
payload[(size_t)len]=0;
|
||||||
|
|
||||||
const char *did=(const char *)payload;
|
const char *did=(const char *)payload;
|
||||||
unsigned i=0;
|
unsigned i=0;
|
||||||
while(i<len && payload[i] && payload[i]!='|')
|
while (i<(size_t)len && payload[i] && payload[i]!='|')
|
||||||
i++;
|
i++;
|
||||||
payload[i]=0;
|
payload[i]=0;
|
||||||
const char *name = (const char *)payload+i+1;
|
const char *name = (const char *)payload+i+1;
|
||||||
|
Loading…
Reference in New Issue
Block a user