mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
global/global_context: always add '\0' after strncpy()
see also f35fa1c58cf24275458cb83097c57bdfd1184cf8 Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
parent
880468b4bf
commit
8ceb11416d
@ -57,10 +57,12 @@ int note_io_error_event(
|
||||
{
|
||||
g_eio = true;
|
||||
if (devname) {
|
||||
strncpy(g_eio_devname, devname, sizeof(g_eio_devname));
|
||||
strncpy(g_eio_devname, devname, sizeof(g_eio_devname) - 1);
|
||||
g_eio_devname[sizeof(g_eio_devname) - 1] = '\0';
|
||||
}
|
||||
if (path) {
|
||||
strncpy(g_eio_path, path, sizeof(g_eio_path));
|
||||
strncpy(g_eio_path, path, sizeof(g_eio_path) - 1);
|
||||
g_eio_path[sizeof(g_eio_path) - 1] = '\0';
|
||||
}
|
||||
g_eio_error = error;
|
||||
g_eio_iotype = iotype;
|
||||
|
Loading…
Reference in New Issue
Block a user