diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-08-03 18:19:11 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2019-08-03 19:31:14 -0700 |
commit | 2178c7445a3464bd69637ad91a2dd0320a60e0df (patch) | |
tree | f8859af93eafcf4e321ab8170567070bcf00c057 /src/fc | |
parent | d4c941ea8b1dc07a14efce656bff58d31a14c985 (diff) | |
download | xorg-lib-libXfont-2178c7445a3464bd69637ad91a2dd0320a60e0df.tar.gz |
Use bounds checking string functions everywhere
Replace strcpy, strcat, sprintf with strlcpy, strlcat, snprintf
everywhere, even where there were already bounds checks in place,
to reduce time spent checking static analysis results.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'src/fc')
-rw-r--r-- | src/fc/fserve.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fc/fserve.c b/src/fc/fserve.c index acea577..46f100e 100644 --- a/src/fc/fserve.c +++ b/src/fc/fserve.c @@ -54,6 +54,7 @@ in this Software without prior written authorization from The Open Group. #include <config.h> #endif #include "libxfontint.h" +#include "src/util/replace.h" #ifdef WIN32 #define _WILLWINSOCK_ @@ -3369,8 +3370,9 @@ static FSFpePtr _fs_init_conn (const char *servername, FontPathElementPtr fpe) { FSFpePtr conn; + size_t snlen = strlen (servername) + 1; - conn = calloc (1, sizeof (FSFpeRec) + strlen (servername) + 1); + conn = calloc (1, sizeof (FSFpeRec) + snlen); if (!conn) return 0; if (!_fs_io_init (conn)) @@ -3382,7 +3384,7 @@ _fs_init_conn (const char *servername, FontPathElementPtr fpe) conn->fs_conn_state = FS_CONN_UNCONNECTED; conn->fs_fd = -1; conn->fpe = fpe; - strcpy (conn->servername, servername); + strlcpy (conn->servername, servername, snlen); return conn; } |