Silenced warnings about string lengths in snprintf()

Adjust string lengths to the worst case estimated by the compiler, even
though they cannot be reached.
This commit is contained in:
Jean-Pierre André 2020-03-08 09:29:04 +01:00
parent c5530af508
commit b68c27ea74
2 changed files with 3 additions and 2 deletions

View File

@ -141,7 +141,8 @@ static int fstrim_limits(ntfs_volume *vol,
u64 *discard_max_bytes)
{
struct stat statbuf;
char path1[80], path2[80];
char path1[40]; /* holds "/sys/dev/block/%d:%d" */
char path2[40 + sizeof(path1)]; /* less than 40 bytes more than path1 */
int ret;
/* Stat the backing device. Caller has ensured it is a block device. */

View File

@ -45,8 +45,8 @@ canonicalize_dm_name(const char *ptname, char *canonical)
{
FILE *f;
size_t sz;
char path[MAPPERNAMELTH + 24];
char name[MAPPERNAMELTH + 16];
char path[sizeof(name) + 16];
char *res = NULL;
snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptname);