diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c index 67e718b6ea..c121d26179 100644 --- a/src/shared/fstab-util.c +++ b/src/shared/fstab-util.c @@ -305,19 +305,25 @@ static char *tag_to_udev_node(const char *tagvalue, const char *by) { } char *fstab_node_to_udev_node(const char *p) { + const char *q; + assert(p); - if (startswith(p, "LABEL=")) - return tag_to_udev_node(p+6, "label"); + q = startswith(p, "LABEL="); + if (q) + return tag_to_udev_node(q, "label"); - if (startswith(p, "UUID=")) - return tag_to_udev_node(p+5, "uuid"); + q = startswith(p, "UUID="); + if (q) + return tag_to_udev_node(q, "uuid"); - if (startswith(p, "PARTUUID=")) - return tag_to_udev_node(p+9, "partuuid"); + q = startswith(p, "PARTUUID="); + if (q) + return tag_to_udev_node(q, "partuuid"); - if (startswith(p, "PARTLABEL=")) - return tag_to_udev_node(p+10, "partlabel"); + q = startswith(p, "PARTLABEL="); + if (q) + return tag_to_udev_node(q, "partlabel"); return strdup(p); }