Fix some problems found by Coverity static analysis.

This commit is contained in:
Milan Broz
2012-09-19 13:58:00 +02:00
parent bec7fcb14a
commit 89e09afdf6
8 changed files with 33 additions and 20 deletions

View File

@@ -139,7 +139,7 @@ char *crypt_lookup_dev(const char *dev_id)
if (snprintf(path, sizeof(path), "/sys/dev/block/%s", dev_id) < 0)
return NULL;
len = readlink(path, link, sizeof(link));
len = readlink(path, link, sizeof(link) - 1);
if (len < 0) {
/* Without /sys use old scan */
if (stat("/sys/dev/block", &st) < 0)