lsblk: fix hctl buffer usage [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2013-03-27 14:17:52 +01:00
parent 65060bd04d
commit 88a6006bc8
1 changed files with 2 additions and 1 deletions

View File

@ -653,9 +653,10 @@ int sysfs_scsi_get_hctl(struct sysfs_cxt *cxt, int *h, int *c, int *t, int *l)
return len;
buf[len] = '\0';
hctl = strrchr(buf, '/') + 1;
hctl = strrchr(buf, '/');
if (!hctl)
return -1;
hctl++;
if (sscanf(hctl, "%d:%d:%d:%d", &cxt->scsi_host, &cxt->scsi_channel,
&cxt->scsi_target, &cxt->scsi_lun) != 4)