summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/print_disk_info.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/print_disk_info.c b/src/print_disk_info.c
index 3be81ea..fb73480 100644
--- a/src/print_disk_info.c
+++ b/src/print_disk_info.c
@@ -142,7 +142,7 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch
mounted = false;
} else {
char *sanitized = sstrdup(path);
- if (sanitized[strlen(sanitized) - 1] == '/')
+ if (strlen(sanitized) > 1 && sanitized[strlen(sanitized) - 1] == '/')
sanitized[strlen(sanitized) - 1] = '\0';
FILE *mntentfile = setmntent("/etc/mtab", "r");
struct mntent *m;