aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-08-29 16:32:29 -0500
committerTed Gould <ted@gould.cx>2012-08-29 16:32:29 -0500
commit3642390b3c53f469916e02f7a1bebe4ebd0aeba3 (patch)
treeb99989f318b8389d1a96bcb6f632f346e0b86b03
parent3c0dce874eeb33720f8b136e661035598689d302 (diff)
downloadlightdm-remote-session-arctica-3642390b3c53f469916e02f7a1bebe4ebd0aeba3.tar.gz
lightdm-remote-session-arctica-3642390b3c53f469916e02f7a1bebe4ebd0aeba3.tar.bz2
lightdm-remote-session-arctica-3642390b3c53f469916e02f7a1bebe4ebd0aeba3.zip
Check the return from snprintf
-rw-r--r--socket-sucker.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/socket-sucker.c b/socket-sucker.c
index 7a1e82f..d711cb0 100644
--- a/socket-sucker.c
+++ b/socket-sucker.c
@@ -41,7 +41,12 @@ main (int argc, char * argv[])
}
serv_addr.sun_family = AF_UNIX;
- snprintf(serv_addr.sun_path, sizeof(serv_addr.sun_path), "%s/%s", home, ".freerdp-socket");
+
+ int printsize = snprintf(serv_addr.sun_path, sizeof(serv_addr.sun_path) - 1, "%s/%s", home, ".freerdp-socket");
+ if (printsize > sizeof(serv_addr.sun_path) - 1) {
+ return -1;
+ }
+
servlen = strlen(serv_addr.sun_path) + sizeof(serv_addr.sun_family);
if ((socket_fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {