summaryrefslogtreecommitdiffstats
path: root/libdwfl/linux-pid-attach.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdwfl/linux-pid-attach.c')
-rw-r--r--libdwfl/linux-pid-attach.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libdwfl/linux-pid-attach.c b/libdwfl/linux-pid-attach.c
index f19e9b49..3a6af997 100644
--- a/libdwfl/linux-pid-attach.c
+++ b/libdwfl/linux-pid-attach.c
@@ -422,7 +422,11 @@ dwfl_linux_proc_attach (Dwfl *dwfl, pid_t pid, bool assume_ptrace_stopped)
char name[64];
int i = snprintf (name, sizeof (name), "/proc/%ld/task", (long) pid);
- assert (i > 0 && i < (ssize_t) sizeof (name) - 1);
+ if (i <= 0 || i >= (ssize_t) sizeof (name) - 1)
+ {
+ errno = -ENOMEM;
+ goto fail;
+ }
DIR *dir = opendir (name);
if (dir == NULL)
{