debugd: Fix an off-by-one error with PATH_MAX

If the path is as long as PATH_MAX then its nul terminator will exceed
the limit. Correct this.

BUG=chromium:1085464
TEST=FEATURES=test emerge-nami debugd

Change-Id: I4be35b0e5248f3180efbdcc344f767d5f1452908
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform2/+/2240210
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Maksim Ivanov <emaxx@chromium.org>
Reviewed-by: Paul Moy <pmoy@chromium.org>
diff --git a/debugd/src/helper_utils_test.cc b/debugd/src/helper_utils_test.cc
index c4eb2b7..490af5e 100644
--- a/debugd/src/helper_utils_test.cc
+++ b/debugd/src/helper_utils_test.cc
@@ -4,6 +4,8 @@
 
 #include "debugd/src/helper_utils.h"
 
+#include <limits.h>
+
 #include <gtest/gtest.h>
 
 namespace debugd {
@@ -16,6 +18,9 @@
 
   EXPECT_TRUE(GetHelperPath("test/me", &full_path));
   EXPECT_EQ("/usr/libexec/debugd/helpers/test/me", full_path);
+
+  std::string str(PATH_MAX, 'x');
+  EXPECT_FALSE(GetHelperPath(str, &full_path));
 }
 
 }  // namespace debugd