gcc 10.2 complains about the strncpy call here, since it's possible that
the source string is so long that the fspath inside the fdhash structure
will end up without a null terminator. Work around strncpy braindamage
yet again by forcing the string to be terminated properly.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
}
fdhp->fsfd = fd;
- strncpy(fdhp->fspath, fspath, sizeof(fdhp->fspath));
+ strncpy(fdhp->fspath, fspath, sizeof(fdhp->fspath) - 1);
+ fdhp->fspath[sizeof(fdhp->fspath) - 1] = 0;
memcpy(fdhp->fsh, *fshanp, FSIDSIZE);
fdhp->fnxt = fdhash_head;