8076475: Misuses of strncpy/strncat

Various small fixes around strncpy and strncat

Reviewed-by: dsamersoff, coleenp
This commit is contained in:
Thomas Stuefe 2015-04-07 14:19:03 +02:00
parent 137a04308f
commit c034b74806
12 changed files with 56 additions and 52 deletions

View file

@ -159,7 +159,12 @@ lib_info* add_lib_info_fd(struct ps_prochandle* ph, const char* libname, int fd,
return NULL;
}
strncpy(newlib->name, libname, sizeof(newlib->name));
if (strlen(libname) >= sizeof(newlib->name)) {
print_debug("libname %s too long\n", libname);
return NULL;
}
strcpy(newlib->name, libname);
newlib->base = base;
if (fd == -1) {