From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nikolas Nyby <nikolas@gnu.org>
Date: Aug, 30 2026 20:18:06 +0100
Subject: [PATCH] <short summary of the patch>

TODO: Put a short summary on the line above and replace this paragraph
with a longer explanation of this change. Complete the meta-information
with other relevant fields (see below for details). To make it easier, the
information below has been extracted from the changelog. Adjust it or drop
it.

---
The information above should follow the Patch Tagging Guidelines, please
checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
Bug: <upstream-bugtracker-url>
Bug-<Vendor>: <vendor-bugtracker-url>
Forwarded: (no|not-needed|<patch-forwarded-url>)
Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
Reviewed-By: <name and email of someone who approved/reviewed the patch>

--- dillo-3.3.0.orig/src/dilloc.c
+++ dillo-3.3.0/src/dilloc.c
@@ -104,11 +104,9 @@ connect_given_pid(int *sock, const char
 static int
 find_working_socket(int *sock)
 {
-   char ctlpath[PATH_MAX];
-   if (snprintf(ctlpath, PATH_MAX, "%s/.dillo/ctl", dGethomedir()) >= PATH_MAX) {
-      fprintf(stderr, "path too long\n");
-      return -1;
-   }
+   int sz = snprintf(NULL, 0, "%s/.dillo/ctl", dGethomedir());
+   char ctlpath[sz+1];
+   snprintf(ctlpath, sz, "%s/.dillo/ctl", dGethomedir());
 
    struct dirent *ep;
    DIR *dp = opendir(ctlpath);
