Handle missing UUID/LABEL from blkid.
Bug: 11627785
Change-Id: Iee757abbc3795234f41d513a6aed8ad33855cb7a
diff --git a/Volume.cpp b/Volume.cpp
index 9bf86bb..6dd1cc0 100644
--- a/Volume.cpp
+++ b/Volume.cpp
@@ -668,15 +668,15 @@
if (fgets(line, sizeof(line), fp) != NULL) {
ALOGD("blkid identified as %s", line);
- char* start = strstr(line, "UUID=") + 5;
- if (sscanf(start, "\"%127[^\"]\"", value) == 1) {
+ char* start = strstr(line, "UUID=");
+ if (start != NULL && sscanf(start + 5, "\"%127[^\"]\"", value) == 1) {
setUuid(value);
} else {
setUuid(NULL);
}
- start = strstr(line, "LABEL=") + 6;
- if (sscanf(start, "\"%127[^\"]\"", value) == 1) {
+ start = strstr(line, "LABEL=");
+ if (start != NULL && sscanf(start + 6, "\"%127[^\"]\"", value) == 1) {
setUserLabel(value);
} else {
setUserLabel(NULL);