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); |