musikcube: fix realpath buffer overflow

This commit is contained in:
eater 2019-01-22 11:50:16 +01:00 committed by maxice8
parent cdde1bbf78
commit 9be5dde8c2
2 changed files with 34 additions and 1 deletions

View file

@ -0,0 +1,33 @@
From 3fb2c0658ab3d3ab7a92587dac426b057433fcf8 Mon Sep 17 00:00:00 2001
From: eater <=@eater.me>
Date: Sun, 20 Jan 2019 15:21:59 +0100
Subject: [PATCH] Fix: let libc set length of resolved in realpath
---
src/plugins/gmedecoder/Constants.h | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git src/plugins/gmedecoder/Constants.h src/plugins/gmedecoder/Constants.h
index bcd887c7..62ef2e00 100644
--- src/plugins/gmedecoder/Constants.h
+++ src/plugins/gmedecoder/Constants.h
@@ -221,6 +221,12 @@ static inline std::string canonicalizePath(const std::string& path) {
delete[] dest;
}
return result8;
+#elif __gnu_linux__
+ char* realname = realpath(path.c_str(), NULL);
+ if (!realname) {
+ return "";
+ }
+ return std::string(realname);
#else
char realname[_POSIX_PATH_MAX];
if (realpath(path.c_str(), realname) == 0) {
@@ -228,4 +234,4 @@ static inline std::string canonicalizePath(const std::string& path) {
}
return std::string(realname);
#endif
-}
\ No newline at end of file
+}

View file

@ -1,7 +1,7 @@
# Template file for 'musikcube'
pkgname=musikcube
version=0.61.0
revision=1
revision=2
build_style=cmake
configure_args="-DNO_NCURSESW=1"
makedepends="boost-devel libogg-devel libmicrohttpd-devel ffmpeg-devel