agent/src/os/linux/libproc_impl.c

changeset 9920
3a3803a0c789
parent 9683
fba8dbd018a6
child 9931
fd44df5e3bc3
     1.1 --- a/agent/src/os/linux/libproc_impl.c	Mon Sep 23 20:26:18 2019 +0200
     1.2 +++ b/agent/src/os/linux/libproc_impl.c	Fri Apr 03 14:14:26 2020 +0100
     1.3 @@ -159,7 +159,12 @@
     1.4        return NULL;
     1.5     }
     1.6  
     1.7 -   strncpy(newlib->name, libname, sizeof(newlib->name));
     1.8 +   if (strlen(libname) >= sizeof(newlib->name)) {
     1.9 +     print_debug("libname %s too long\n", libname);
    1.10 +     return NULL;
    1.11 +   }
    1.12 +   strcpy(newlib->name, libname);
    1.13 +
    1.14     newlib->base = base;
    1.15  
    1.16     if (fd == -1) {

mercurial