]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsblk: fix hctl buffer usage [coverity scan]
authorKarel Zak <kzak@redhat.com>
Wed, 27 Mar 2013 13:17:52 +0000 (14:17 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 27 Mar 2013 13:18:22 +0000 (14:18 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/sysfs.c

index d14459b7305191cfc0d476f3ae8b2f06da0b6a95..a87e9e3d07a690dfb143bd66bcae5e9a667c1cc2 100644 (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)