patch 9.1.2141: Truncation when serializing libsodium encryption parameters

Commit: 
https://github.com/vim/vim/commit/60e93b5de7b2ebdf39a84f6d19873ac4d4686a57
Author: Yasuhiro Matsumoto <[email protected]>
Date:   Sun Feb 8 21:04:51 2026 +0000

    patch 9.1.2141: Truncation when serializing libsodium encryption parameters
    
    Problem:  Truncation when serializing libsodium encryption parameters.
    Solution: Correctly cast to long long type (Yasuhiro Matsumoto).
    
    fixes:  #19248
    closes: #19357
    
    Signed-off-by: Yasuhiro Matsumoto <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/runtime/doc/version9.txt b/runtime/doc/version9.txt
index e2bc66be0..c5ed3da00 100644
--- a/runtime/doc/version9.txt
+++ b/runtime/doc/version9.txt
@@ -1,4 +1,4 @@
-*version9.txt* For Vim version 9.1.  Last change: 2026 Feb 07
+*version9.txt* For Vim version 9.1.  Last change: 2026 Feb 08
 
 
                  VIM REFERENCE MANUAL    by Bram Moolenaar
@@ -52528,4 +52528,8 @@ Problem:  tests: Test_wayland_protocol_error_overflow() 
fails
           (after v9.1.2139)
 Solution: try/catch the expected error
 
+Patch 9.1.2141
+Problem:  Truncation when serializing libsodium encryption parameters.
+Solution: Correctly cast to long long type (Yasuhiro Matsumoto).
+
  vim:tw=78:ts=8:noet:ft=help:norl:fdm=manual:nofoldenable
diff --git a/src/crypt.c b/src/crypt.c
index da1022644..794594f91 100644
--- a/src/crypt.c
+++ b/src/crypt.c
@@ -1356,7 +1356,7 @@ crypt_long_long_to_char(long long n, char_u *s)
     for (i = 0; i < 8; i++)
     {
        s[i] = (char_u)(n & 0xff);
-       n = (unsigned)n >> 8;
+       n = (unsigned long long)n >> 8;
     }
 }
 
@@ -1367,7 +1367,7 @@ crypt_int_to_char(int n, char_u *s)
     for (i = 0; i < 4; i++)
     {
        s[i] = (char_u)(n & 0xff);
-       n = (unsigned)n >> 8;
+       n = (unsigned long long)n >> 8;
     }
 }
 
diff --git a/src/version.c b/src/version.c
index e6b867cf6..5f437f42d 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2141,
 /**/
     2140,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vpC7U-002NW0-4R%40256bit.org.

Raspunde prin e-mail lui