Skip to content
This repository has been archived by the owner on Aug 4, 2024. It is now read-only.

Commit

Permalink
fixup: Magisk: disable UTF-8 checks when on Windows (#26)
Browse files Browse the repository at this point in the history
- this fixes #26

Signed-off-by: Ookiineko <chiisaineko@protonmail.com>
  • Loading branch information
Ookiineko committed Apr 8, 2024
1 parent d262314 commit de80176
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions patches/Magisk/0010-workaround-UTF-8-issues-on-Windows.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 7f4f80f0d520abb0fdf25a02bdc656f66fb5b797 Mon Sep 17 00:00:00 2001
From: Ookiineko <chiisaineko@protonmail.com>
Date: Tue, 9 Apr 2024 00:45:17 +0800
Subject: [PATCH] workaround UTF-8 issues on Windows

Signed-off-by: Ookiineko <chiisaineko@protonmail.com>
---
native/src/base/cstr.rs | 2 ++
1 file changed, 2 insertions(+)

diff --git a/native/src/base/cstr.rs b/native/src/base/cstr.rs
index d93db87..4bbbeb9 100644
--- a/native/src/base/cstr.rs
+++ b/native/src/base/cstr.rs
@@ -312,7 +312,9 @@ pub struct Utf8CStr([u8]);
impl Utf8CStr {
pub fn from_cstr(cstr: &CStr) -> Result<&Utf8CStr, StrErr> {
// Validate the buffer during construction
+ #[cfg(not(target_os = "windows"))]
str::from_utf8(cstr.to_bytes())?;
+
Ok(unsafe { Self::from_bytes_unchecked(cstr.to_bytes_with_nul()) })
}

--
2.44.0

0 comments on commit de80176

Please sign in to comment.