Coverity fixes for primary_mirror_mode.c
CID 129287 Buffer not null terminated. In primaryMirrorCheckNICFailure: The string buffers `localHost` and `peerHost` may not have a null terminator if the source string's length is equal to the buffer size. Hence use strlcpy instead to be same. CID 130101 Dereference before null check. In isFilespaceInfoConsistent: All paths that lead to `primaryFilespaceLocation` null pointer comparison already dereference the pointer earlier. Since `primaryFilespaceLocation` cannot be null else PersistentFilespace_GetPrimaryAndMirror() will error out itself, removing the check for null. CID 130130 Copy into fixed size buffer. In primaryMirrorPopulateFilespaceInfo: A source buffer `pch` of statically unknown size is copied into a fixed-size destination buffer `peerFilespacePath`. Hence replace strcpy with strlcpy. CID 159071 Uninitialized scalar variable. In primaryMirrorPopulateFilespaceInfo: Use of an uninitialized variable filespacePath. Hence initialing it in else path to empty string.
Showing
想要评论请 注册 或 登录