Disallow header restore if context is nonLUKS device.
[platform/upstream/cryptsetup.git] / lib / utils_crypt.c
index 4433dc7..a5d9904 100644 (file)
@@ -92,7 +92,9 @@ void *crypt_safe_alloc(size_t size)
                return NULL;
 
        alloc->size = size;
+       memset(&alloc->data, 0, size);
 
+       /* coverity[leaked_storage] */
        return &alloc->data;
 }
 
@@ -509,10 +511,13 @@ int crypt_string_to_size(struct crypt_device *cd, const char *s, uint64_t *size)
                break;
        case 't':
        case 'T': mult *= mult_base;
+                /* Fall through */
        case 'g':
        case 'G': mult *= mult_base;
+                /* Fall through */
        case 'm':
        case 'M': mult *= mult_base;
+                /* Fall through */
        case 'k':
        case 'K': mult *= mult_base;
                break;