if(s >= 0) {
send(s, request, sizeof(request) - 1, 0);
- int len = recv(s, line, sizeof(line) - 1, MSG_WAITALL);
+ ssize_t len = recv(s, line, sizeof(line) - 1, MSG_WAITALL);
if(len > 0) {
line[len] = 0;
// Check that the hostname is reasonable
if(hostname) {
for(char *p = hostname; *p; p++) {
- if(isalnum(*p) || *p == '-' || *p == '.' || *p == ':') {
+ if(isalnum((uint8_t) *p) || *p == '-' || *p == '.' || *p == ':') {
continue;
}
}
for(char *p = line; *p; p++) {
- if(isalnum(*p) || *p == '-' || *p == '.') {
+ if(isalnum((uint8_t) *p) || *p == '-' || *p == '.') {
continue;
}
return 1;
}
+ free(myname);
myname = get_my_name(true);
if(!myname) {
randomize(cookie, 18);
// Create a filename that doesn't reveal the cookie itself
- char buf[18 + strlen(fingerprint)];
+ uint8_t buf[18 + strlen(fingerprint)];
char cookiehash[64];
memcpy(buf, cookie, 18);
memcpy(buf + 18, fingerprint, sizeof(buf) - 18);
return NULL;
}
- if(len && !isprint(**data)) {
+ if(len && !isprint((uint8_t) **data)) {
abort();
}
static char value[1024];
const char *p = data;
- int varlen = strlen(var);
+ size_t varlen = strlen(var);
// Skip all lines not starting with var
while(strncasecmp(p, var, varlen) || !strchr(" \t=", p[varlen])) {
}
// Split line into variable and value
- int len = strcspn(l, "\t =");
+ size_t len = strcspn(l, "\t =");
value = l + len;
value += strspn(value, "\t ");
continue;
}
- int len = strcspn(l, "\t =");
+ size_t len = strcspn(l, "\t =");
if(len == 4 && !strncasecmp(l, "Name", 4)) {
value = l + len;
static bool invitation_send(void *handle, uint8_t type, const void *vdata, size_t len) {
(void)handle;
(void)type;
- const char *data = vdata;
+ const uint8_t *data = vdata;
while(len) {
- int result = send(sock, data, len, 0);
+ ssize_t result = send(sock, data, len, 0);
if(result == -1 && sockwouldblock(sockerrno)) {
continue;
fprintf(stderr, "Connected to %s port %s...\n", address, port);
// Tell him we have an invitation, and give him our throw-away key.
- int len = snprintf(line, sizeof(line), "0 ?%s %d.%d\n", b64key, PROT_MAJOR, PROT_MINOR);
+ ssize_t len = snprintf(line, sizeof(line), "0 ?%s %d.%d\n", b64key, PROT_MAJOR, PROT_MINOR);
if(len <= 0 || (size_t)len >= sizeof(line)) {
abort();
char *p = line;
while(len) {
- int done = sptps_receive_data(&sptps, p, len);
+ size_t done = sptps_receive_data(&sptps, p, len);
if(!done) {
return 1;
}
- len -= done;
+ len -= (ssize_t) done;
p += done;
}
}