diff options
author | Wichert Akkerman <wakkerma@debian.org> | 2000-10-18 23:04:24 +0000 |
---|---|---|
committer | Wichert Akkerman <wakkerma@debian.org> | 2000-10-18 23:04:24 +0000 |
commit | 5cdb118820311bce809837164c571e5a5c2ca39b (patch) | |
tree | 29a12484f35c77b15ec5696e42b85874e878f2c0 /utils | |
parent | ca0f4a90bff35f59241342ba7c3754a43e8c5a11 (diff) | |
download | dpkg-5cdb118820311bce809837164c571e5a5c2ca39b.tar.gz |
fix a buffer overflow in cmdname handling
Only abort if we fail to open an existing pidfile
Diffstat (limited to 'utils')
-rw-r--r-- | utils/start-stop-daemon.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index 91eb6e1e2..2b67b5ae1 100644 --- a/utils/start-stop-daemon.c +++ b/utils/start-stop-daemon.c @@ -473,7 +473,9 @@ do_pidfile(const char *name) if (fscanf(f, "%d", &pid) == 1) check(pid); fclose(f); - } + } else if (errno != ENOENT) + fatal("open pidfile %s: %s", name, strerror(errno)); + } /* WTA: this needs to be an autoconf check for /proc/pid existance. @@ -541,18 +543,18 @@ do_procinit(void) static int do_stop(void) { - char what[1024]; + char what[2048]; struct pid_list *p; int retval = 0; if (cmdname) - strcpy(what, cmdname); + snprintf(what, sizeof(what), "%s", cmdname); else if (execname) - strcpy(what, execname); + snprintf(what, sizeof(what), "%s", execname); else if (pidfile) - sprintf(what, "process in pidfile `%s'", pidfile); + snprintf(what, sizeof(what), "process in pidfile `%s'", pidfile); else if (userspec) - sprintf(what, "process(es) owned by `%s'", userspec); + snprintf(what, sizeof(what), "process(es) owned by `%s'", userspec); else fatal("internal error, please report"); |