From 0f942e5f015cb3270e6f2e17c308bee894cb5fe3 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Sun, 25 Sep 2011 11:39:13 -0700 Subject: Convert a bunch of sprintf calls to snprintf Signed-off-by: Alan Coopersmith Reviewed-by: Jeremy Huddleston --- Xtranssock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Xtranssock.c') diff --git a/Xtranssock.c b/Xtranssock.c index 1275196..955516d 100644 --- a/Xtranssock.c +++ b/Xtranssock.c @@ -840,7 +840,7 @@ set_sun_path(const char *port, const char *upath, char *path, int abstract) if (strlen(port) + strlen(upath) > maxlen) return -1; - sprintf(path, "%s%s%s", at, upath, port); + snprintf(path, sizeof(s.sun_path), "%s%s%s", at, upath, port); return 0; } #endif @@ -960,7 +960,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int { /* fixup the server port address */ tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); - sprintf (portbuf,"%lu", tmpport); + snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); port = portbuf; } #endif @@ -1457,7 +1457,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port) if (is_numeric (port)) { long tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); - sprintf (portbuf, "%lu", tmpport); + snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); port = portbuf; } #endif -- cgit v1.2.3