Merge "Merge branch 'upstream' into tizen" into tizen
[platform/upstream/cryptsetup.git] / lib / utils_devpath.c
index b6c8975..44d7028 100644 (file)
@@ -3,8 +3,8 @@
  *
  * Copyright (C) 2004 Jana Saout <jana@saout.de>
  * Copyright (C) 2004-2007 Clemens Fruhwirth <clemens@endorphin.org>
- * Copyright (C) 2009-2020 Red Hat, Inc. All rights reserved.
- * Copyright (C) 2009-2020 Milan Broz
+ * Copyright (C) 2009-2021 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2009-2021 Milan Broz
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -367,7 +367,9 @@ char *crypt_get_base_device(const char *dev_path)
        if (dm_is_dm_kernel_name(devname))
                return NULL;
 
-       snprintf(part_path, sizeof(part_path), "/dev/%s", devname);
+       if (snprintf(part_path, sizeof(part_path), "/dev/%s", devname) < 0)
+               return NULL;
+
        return strdup(part_path);
 }