diff options
author | David Tardon <dtardon@redhat.com> | 2012-07-03 10:35:47 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2012-07-03 17:47:19 +0200 |
commit | aea8838e25a72b08e9b79cf9876719f1941fe3cb (patch) | |
tree | 7a9021a14c0d268ebfaeff29e0dcb83d56bf3428 /sal | |
parent | 9bd1acd164a9f8f4188ca06527ccc0fece7d0c19 (diff) |
coverity: ensure the string is null-terminated
Change-Id: I88040319f931598ca4fa17e440e0dba214109dfa
Diffstat (limited to 'sal')
-rw-r--r-- | sal/osl/unx/pipe.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sal/osl/unx/pipe.c b/sal/osl/unx/pipe.c index fd472fa18e43..48b3f3817197 100644 --- a/sal/osl/unx/pipe.c +++ b/sal/osl/unx/pipe.c @@ -279,7 +279,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions OSL_TRACE("osl_createPipe : Pipe Name '%s'",name); addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, name, sizeof(addr.sun_path)); + strncpy(addr.sun_path, name, sizeof(addr.sun_path) - 1); #if defined(FREEBSD) len = SUN_LEN(&addr); #else @@ -321,7 +321,7 @@ oslPipe SAL_CALL osl_psz_createPipe(const sal_Char *pszPipeName, oslPipeOptions chmod(name,S_IRWXU | S_IRWXG |S_IRWXO); - strncpy(pPipe->m_Name, name, sizeof(pPipe->m_Name)); + strncpy(pPipe->m_Name, name, sizeof(pPipe->m_Name) - 1); if ( listen(pPipe->m_Socket, 5) < 0 ) { @@ -409,7 +409,7 @@ void SAL_CALL osl_closePipe( oslPipe pPipe ) OSL_TRACE("osl_destroyPipe : Pipe Name '%s'",pPipe->m_Name); addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, pPipe->m_Name, sizeof(addr.sun_path)); + strncpy(addr.sun_path, pPipe->m_Name, sizeof(addr.sun_path) - 1); len = sizeof(addr); nRet = connect( fd, (struct sockaddr *)&addr, len); |