All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1] expect: Fix buffer overflow error when build in long path
@ 2019-09-24  7:34 Robert Yang
  2019-09-24  7:34 ` [PATCH 1/1] " Robert Yang
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Yang @ 2019-09-24  7:34 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit 95ad5626296380358c8a502a3e04879dab653d78:

  build-appliance-image: Update to master head revision (2019-09-19 20:32:47 +0100)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib rbt/expect
  http://cgit.openembedded.org/openembedded-core-contrib/log/?h=rbt/expect

Robert Yang (1):
  expect: Fix buffer overflow error when build in long path

 ...0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch | 55 ++++++++++++++++++++++
 meta/recipes-devtools/expect/expect_5.45.4.bb      |  1 +
 2 files changed, 56 insertions(+)
 create mode 100644 meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch

-- 
2.7.4



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/1] expect: Fix buffer overflow error when build in long path
  2019-09-24  7:34 [PATCH 0/1] expect: Fix buffer overflow error when build in long path Robert Yang
@ 2019-09-24  7:34 ` Robert Yang
  2019-09-24 11:19   ` Ross Burton
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Yang @ 2019-09-24  7:34 UTC (permalink / raw)
  To: openembedded-core

Fixed when built the project in a long path (len(TMPDIR) > 200):
$ bitbake dejagnu-native
[snip]
checking Tcl version 8.5 or greater... *** buffer overflow detected ***:
TOPDIR/tmp-glibc/work/x86_64-linux/dejagnu-native/1.6.2-r0/recipe-sysroot-native/usr/bin/expect terminated
[snip]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 ...0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch | 55 ++++++++++++++++++++++
 meta/recipes-devtools/expect/expect_5.45.4.bb      |  1 +
 2 files changed, 56 insertions(+)
 create mode 100644 meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch

diff --git a/meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch b/meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch
new file mode 100644
index 0000000..37512fb
--- /dev/null
+++ b/meta/recipes-devtools/expect/expect/0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch
@@ -0,0 +1,55 @@
+From 1407fcad6f1dac0a4efe8041660bf6139c1cd16a Mon Sep 17 00:00:00 2001
+From: Robert Yang <liezhi.yang@windriver.com>
+Date: Tue, 24 Sep 2019 13:40:10 +0800
+Subject: [PATCH] exp_main_sub.c: Use PATH_MAX for path
+
+If expect was built from a long path whose length > 200, then it couldn't run:
+$ expect -c 'puts yes'
+*** buffer overflow detected ***: expect terminated
+Aborted (core dumped)
+
+Use PATH_MAX to fix the problem.
+
+Upstream-Status: Pending [Upstream seems dead]
+
+Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
+---
+ exp_main_sub.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/exp_main_sub.c b/exp_main_sub.c
+index fcfaa6e..bf6c4be 100644
+--- a/exp_main_sub.c
++++ b/exp_main_sub.c
+@@ -48,6 +48,10 @@ char exp_version[] = PACKAGE_VERSION;
+ #define NEED_TCL_MAJOR		7
+ #define NEED_TCL_MINOR		5
+ 
++#ifndef PATH_MAX
++#define PATH_MAX 4096
++#endif
++
+ char *exp_argv0 = "this program";	/* default program name */
+ void (*exp_app_exit)() = 0;
+ void (*exp_event_exit)() = 0;
+@@ -901,7 +905,7 @@ int sys_rc;
+ 	int rc;
+ 
+ 	if (sys_rc) {
+-	    char file[200];
++	    char file[PATH_MAX];
+ 	    int fd;
+ 
+ 	    sprintf(file,"%s/expect.rc",SCRIPTDIR);
+@@ -917,7 +921,7 @@ int sys_rc;
+ 	    }
+ 	}
+ 	if (my_rc) {
+-	    char file[200];
++	    char file[PATH_MAX];
+ 	    char *home;
+ 	    int fd;
+ 	    char *getenv();
+-- 
+2.7.4
+
diff --git a/meta/recipes-devtools/expect/expect_5.45.4.bb b/meta/recipes-devtools/expect/expect_5.45.4.bb
index 96eacd9..dcd252f 100644
--- a/meta/recipes-devtools/expect/expect_5.45.4.bb
+++ b/meta/recipes-devtools/expect/expect_5.45.4.bb
@@ -25,6 +25,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/expect/Expect/${PV}/${BPN}${PV}.tar.gz \
            file://0001-expect-install-scripts-without-using-the-fixline1-tc.patch \
            file://0001-Resolve-string-formatting-issues.patch \
            file://0001-expect-Fix-segfaults-if-Tcl-is-built-with-stubs-and-.patch \
+           file://0001-exp_main_sub.c-Use-PATH_MAX-for-path.patch \
           "
 SRC_URI[md5sum] = "00fce8de158422f5ccd2666512329bd2"
 SRC_URI[sha256sum] = "49a7da83b0bdd9f46d04a04deec19c7767bb9a323e40c4781f89caf760b92c34"
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] expect: Fix buffer overflow error when build in long path
  2019-09-24  7:34 ` [PATCH 1/1] " Robert Yang
@ 2019-09-24 11:19   ` Ross Burton
  0 siblings, 0 replies; 3+ messages in thread
From: Ross Burton @ 2019-09-24 11:19 UTC (permalink / raw)
  To: openembedded-core

On 24/09/2019 08:34, Robert Yang wrote:
> +Upstream-Status: Pending [Upstream seems dead]

The web site says to use SourceForge, but that's wrong.  The code is 
(sort of) alive in Fossil at https://core.tcl-lang.org/expect/home so 
please do submit the patch to either their SF or the Fossil instance.

Ross


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-24 11:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24  7:34 [PATCH 0/1] expect: Fix buffer overflow error when build in long path Robert Yang
2019-09-24  7:34 ` [PATCH 1/1] " Robert Yang
2019-09-24 11:19   ` Ross Burton

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.