agent/src/os/linux/libproc_impl.c

changeset 9920
3a3803a0c789
parent 9683
fba8dbd018a6
child 9931
fd44df5e3bc3
equal deleted inserted replaced
9919:e8a0af9fc1cb 9920:3a3803a0c789
157 if ( (newlib = (lib_info*) calloc(1, sizeof(struct lib_info))) == NULL) { 157 if ( (newlib = (lib_info*) calloc(1, sizeof(struct lib_info))) == NULL) {
158 print_debug("can't allocate memory for lib_info\n"); 158 print_debug("can't allocate memory for lib_info\n");
159 return NULL; 159 return NULL;
160 } 160 }
161 161
162 strncpy(newlib->name, libname, sizeof(newlib->name)); 162 if (strlen(libname) >= sizeof(newlib->name)) {
163 print_debug("libname %s too long\n", libname);
164 return NULL;
165 }
166 strcpy(newlib->name, libname);
167
163 newlib->base = base; 168 newlib->base = base;
164 169
165 if (fd == -1) { 170 if (fd == -1) {
166 if ( (newlib->fd = pathmap_open(newlib->name)) < 0) { 171 if ( (newlib->fd = pathmap_open(newlib->name)) < 0) {
167 print_debug("can't open shared object %s\n", newlib->name); 172 print_debug("can't open shared object %s\n", newlib->name);

mercurial