Index: multipath-tools/libmultipath/discovery.c =================================================================== --- multipath-tools.orig/libmultipath/discovery.c +++ multipath-tools/libmultipath/discovery.c @@ -252,7 +252,11 @@ devt2devname (char *devname, char *devt) continue; if ((major == tmpmaj) && (minor == tmpmin)) { - sprintf(block_path, "/sys/block/%s", dev); + if (snprintf(block_path, FILE_NAME_SIZE, "/sys/block/%s", dev) >= FILE_NAME_SIZE) { + condlog(0, "device name %s is too long\n", dev); + fclose(fd); + return 1; + } break; } } @@ -270,6 +274,7 @@ devt2devname (char *devname, char *devt) condlog(0, "sysfs entry %s is not a directory\n", block_path); return 1; } + basename(block_path, devname); return 0; }