summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2012-07-03 10:35:47 +0200
committerDavid Tardon <dtardon@redhat.com>2012-07-03 17:47:19 +0200
commitaea8838e25a72b08e9b79cf9876719f1941fe3cb (patch)
tree7a9021a14c0d268ebfaeff29e0dcb83d56bf3428
parent9bd1acd164a9f8f4188ca06527ccc0fece7d0c19 (diff)
coverity: ensure the string is null-terminated
Change-Id: I88040319f931598ca4fa17e440e0dba214109dfa
-rw-r--r--sal/osl/unx/pipe.c6
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);