From 1bfc5dfd522709a8c4b24f9dcb65070b97048f5d Mon Sep 17 00:00:00 2001 From: Ray Donnelly Date: Sat, 22 Mar 2014 00:50:59 +0000 Subject: [PATCH] msys2-runtime: path patch fixes Fixes for 0003-Add-msys2_path_conv.patch: Early out case fixed, n3, n4, n5 access beyond string fixed Added back 0004-Fix-cygwin-path_conv-of-root.patch: It was dropped by mistake in an earlier commit --- msys2-runtime/0003-Add-msys2_path_conv.patch | 22 +++++++++++--------- msys2-runtime/PKGBUILD | 10 +++++---- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/msys2-runtime/0003-Add-msys2_path_conv.patch b/msys2-runtime/0003-Add-msys2_path_conv.patch index 96b9c40c..d05266c9 100644 --- a/msys2-runtime/0003-Add-msys2_path_conv.patch +++ b/msys2-runtime/0003-Add-msys2_path_conv.patch @@ -15,7 +15,7 @@ diff -Naur a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in diff -Naur a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc --- a/winsup/cygwin/msys2_path_conv.cc 1970-01-01 03:00:00.000000000 +0300 +++ b/winsup/cygwin/msys2_path_conv.cc 2014-03-21 20:53:18.963200000 +0400 -@@ -0,0 +1,606 @@ +@@ -0,0 +1,608 @@ +/* + The MSYS2 Path conversion source code is licensed under: + @@ -251,7 +251,7 @@ diff -Naur a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc + } + + copy_to_dst(copy_from, *from, dst, dstend); -+ ++ + if (type != NONE) { + convert_path(from, *to, type, dst, dstend); + } @@ -268,21 +268,23 @@ diff -Naur a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc + } + + int need_convert = false; -+ for (const char* it = src; it != '\0'; ++it) { ++ for (const char* it = src; *it != '\0'; ++it) { + if (*it == '\\' || *it == '/') { + need_convert = true; + break; + } + } + ++ char* dstit = dst; ++ char* dstend = dst + dstlen; + if (!need_convert) { -+ return src; ++ copy_to_dst(src, NULL, &dstit, dstend); ++ *dstit = '\0'; ++ return dst; + } + + const char* srcit = src; + const char* srcbeg = src; -+ char* dstit = dst; -+ char* dstend = dst + dstlen; + + int prev_was_space = 0; + int in_string = false; @@ -406,10 +408,10 @@ diff -Naur a/winsup/cygwin/msys2_path_conv.cc b/winsup/cygwin/msys2_path_conv.cc + int starts_with_minus = (*it == '-'); + + if (starts_with_minus) { -+ char n2 = *(it + 2); -+ char n3 = *(it + 3); -+ char n4 = *(it + 4); -+ char n5 = *(it + 5); ++ char n2 = *(it + 2); ++ char n3 = n2 ? *(it + 3) : '\0'; ++ char n4 = n3 ? *(it + 4) : '\0'; ++ char n5 = n4 ? *(it + 5) : '\0'; + + if (n2 == '/') { + it += 2; diff --git a/msys2-runtime/PKGBUILD b/msys2-runtime/PKGBUILD index f19d0bb1..1f1954ed 100644 --- a/msys2-runtime/PKGBUILD +++ b/msys2-runtime/PKGBUILD @@ -12,16 +12,17 @@ license=('GPL') groups=('base') depends=() makedepends=('cocom' 'git' 'perl' 'gcc' 'mingw-w64-cross-gcc' 'mingw-w64-cross-zlib') -#options=('debug' '!strip') +options=('debug' '!strip') source=('msys2-runtime'::'git+https://github.com/Alexpux/Cygwin.git#branch=develop' '0001-Expand-CYGWIN-error_start-processing.patch' '0002-revert-mounting.patch' - '0003-Add-msys2_path_conv.patch') + '0003-Add-msys2_path_conv.patch' + '0004-Fix-cygwin-path_conv-of-root.patch') md5sums=('SKIP' '85fabbc5d9cdb46cf73da9654f2c83bc' 'ace414fde822ae633183fe94cbb0e1d9' - '20d6f4ba12086ade744e9360417b5b80') - + 'fd8d1ad7bbffbb655cc311bb70d75e49' + '4e39847e44316ae7376323e0b7538504') pkgver() { cd "$srcdir/msys2-runtime" #printf "%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" @@ -35,6 +36,7 @@ prepare() { # patch -p1 -i ${srcdir}/0002-revert-mounting.patch # This is the new code, but it doesn't handle Unix PATH lists very well. patch -p1 -i ${srcdir}/0003-Add-msys2_path_conv.patch + patch -p1 -i ${srcdir}/0004-Fix-cygwin-path_conv-of-root.patch } build() {