Skip to content
Permalink
Browse files

fix some more bugs that gcc warnings caught

  • Loading branch information...
shawnl committed May 10, 2019
1 parent aff27de commit 76d8dc6c5eb65e2b3fb151db0338566f1f55dcee
Showing with 6 additions and 5 deletions.
  1. +1 −1 popt/popt.c
  2. +1 −1 src/srvrpc.c
  3. +2 −2 src/stats.c
  4. +2 −1 src/util.c
@@ -591,7 +591,7 @@ expandNextArg(/*@special@*/ poptContext con, const char * s)
*te = '\0';
t = realloc(t, tn);
te = t + strlen(t);
strncpy(te, a, alen); te += alen;
memcpy(te, a, alen); te += alen;
continue;
/*@notreached@*/ /*@switchbreak@*/ break;
default:
@@ -170,7 +170,7 @@ int dcc_r_many_files(int in_fd,
/* We should explain what happened here, but we have already read
* a few more bytes.
*/
strncpy(buf, token, 4);
memcpy(buf, token, 4);
/* TODO(manos): this is probably not kosher */
memcpy(&buf[4], &link_or_file_len, sizeof(link_or_file_len));
dcc_explain_mismatch(buf, 12, in_fd);
@@ -133,8 +133,8 @@ void dcc_stats_compile_ok(char *compiler, char *filename, struct timeval start,
memcpy(&(sd.start), &start, sizeof(struct timeval));
memcpy(&(sd.stop), &stop, sizeof(struct timeval));
sd.time = time_usec;
strncpy(sd.filename, filename, MAX_FILENAME_LEN);
strncpy(sd.compiler, compiler, MAX_FILENAME_LEN);
strncpy(sd.filename, filename, MAX_FILENAME_LEN - 1);
strncpy(sd.compiler, compiler, MAX_FILENAME_LEN - 1);
dcc_writex(dcc_statspipe[1], &sd, sizeof(sd));
}
}
@@ -265,7 +265,8 @@ int dcc_get_dns_domain(const char **domain_name)
hstrerror(h_errno));
return -1;
}
strncpy(host_name, h->h_name, sizeof(host_name));
strncpy(host_name, h->h_name, sizeof(host_name - 1));
host_name[sizeof(host_name) - 1] = '\0';
}
envh = host_name;
}

0 comments on commit 76d8dc6

Please sign in to comment.
You can’t perform that action at this time.