diff options
author | Andrej Shadura <andrewsh@debian.org> | 2021-01-04 18:52:45 +0100 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2021-01-21 12:35:32 +0100 |
commit | 1652f36661832f5438b7e0b1a951fcdeba0f9603 (patch) | |
tree | 0d51c8a38b0ba1ed00a58cb9b19a9b9e9951f11d /src | |
parent | 54ce6ec9a79159b296169f369d40b30ec48cd8de (diff) |
Use snprintf for a bit more robust string handling
Gbp-Pq: Name 18-use-snprintf-for-a-bit-more-robust-string-handling.patch
Diffstat (limited to 'src')
-rw-r--r-- | src/osdsh/connectionwatch.c | 4 | ||||
-rw-r--r-- | src/osdsh/controlsh.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/osdsh/connectionwatch.c b/src/osdsh/connectionwatch.c index 804eaa1..1073fe1 100644 --- a/src/osdsh/connectionwatch.c +++ b/src/osdsh/connectionwatch.c @@ -109,7 +109,7 @@ void *connection_watch(void *arg) if(strcmp(pppdevice, "")==0) sprintf(pppdevice, "%s", PPP_DEVICE); - sprintf(ppp0pidfile, "%s/%s.pid", PPP_PID_PATH, pppdevice); + snprintf(ppp0pidfile, sizeof(ppp0pidfile), "%s/%s.pid", PPP_PID_PATH, pppdevice); if (strcmp(connecting1, "")==0) sprintf(connecting1, "Connecting"); @@ -129,7 +129,7 @@ void *connection_watch(void *arg) xosd_display(pppset.myosd, 0, XOSD_string, connecting1); xosd_display(pppset.myosd, 1, XOSD_string, connecting2); - sprintf(ppp0pidfile, "%s/%s.pid", PPP_PID_PATH, pppdevice); + snprintf(ppp0pidfile, sizeof(ppp0pidfile), "%s/%s.pid", PPP_PID_PATH, pppdevice); if((fp=fopen(ppp0pidfile, "r"))==NULL) { ppp0run = 0; diff --git a/src/osdsh/controlsh.c b/src/osdsh/controlsh.c index 4c9115b..de951d0 100644 --- a/src/osdsh/controlsh.c +++ b/src/osdsh/controlsh.c @@ -130,7 +130,7 @@ void display_stuff(char command[BUFSIZ], char arguments[BUFSIZ]) a = load_plugin( arg_secound); */ a = load_plugin( arg_first ); - sprintf(arg_secound, "Error loading %s", arg_first); + snprintf(arg_secound, sizeof(arg_secound), "Error loading %s", arg_first); if(a>=0) { if(a>n&&a<MAX_PLUGINS) @@ -199,7 +199,7 @@ void *control_sh(void *arg) FILE *fp; char readbuf[BUFSIZ]; - sprintf(fifo_file, "%s.%d",OSD_FIFO_PATH, getuid()); + snprintf(fifo_file, sizeof(fifo_file), "%s.%d",OSD_FIFO_PATH, getuid()); settings.displaying = 1; /* we open the osd*/ settings.myosd = xosd_create (2); @@ -239,7 +239,7 @@ void *control_sh(void *arg) fclose(fp); } unlink(fifo_file); - sprintf(fifo_file, "%s.pid", fifo_file); + snprintf(fifo_file, sizeof(fifo_file), "%s.pid", fifo_file); unlink(fifo_file); xosd_destroy(settings.myosd); exit(0); |