[2/3] extrahd: Skip relative mountpoints

Message ID 20230802091415.3168597-2-michael.tremer@ipfire.org
State Staged
Commit 80eac2b523c6c4aa682d565899c9de77c22b8e61
Headers
Series [1/3] extrahd: Rewrite the mount script in shell |

Commit Message

Michael Tremer Aug. 2, 2023, 9:14 a.m. UTC
  Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
---
 config/extrahd/extrahd.pl | 6 ++++++
 1 file changed, 6 insertions(+)
  

Patch

diff --git a/config/extrahd/extrahd.pl b/config/extrahd/extrahd.pl
index be91e27f6..eba3f9b37 100644
--- a/config/extrahd/extrahd.pl
+++ b/config/extrahd/extrahd.pl
@@ -40,6 +40,12 @@  extrahd_mount() {
 			continue
 		fi
 
+		# Check that the mountpoint starts with a slash
+		if [ "${mountpoint:0:1}" != "/" ]; then
+			log "Skipping invalid mountpoint: ${mountpoint}"
+			continue
+		fi
+
 		# Skip mounting if something is already mounted at the mountpoint
 		if mountpoint "${mountpoint}" &>/dev/null; then
 			continue