<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to 79: zip: Charset conversion fails when zip is built with _FORTIFY_SOURCE</title><link>https://sourceforge.net/p/infozip/bugs/79/</link><description>Recent changes to 79: zip: Charset conversion fails when zip is built with _FORTIFY_SOURCE</description><atom:link href="https://sourceforge.net/p/infozip/bugs/79/feed.rss" rel="self"/><language>en</language><lastBuildDate>Tue, 22 Apr 2025 22:43:37 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/infozip/bugs/79/feed.rss" rel="self" type="application/rss+xml"/><item><title>zip: Charset conversion fails when zip is built with _FORTIFY_SOURCE</title><link>https://sourceforge.net/p/infozip/bugs/79/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;Hello. This is Debian Bug #1077054 and this is the full URL for the bug:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1077054" rel="nofollow"&gt;https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1077054&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Follows a summary of the bug.&lt;/p&gt;
&lt;p&gt;Adam Sampson writes:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;If zip 3.0-14 is built with _FORTIFY_SOURCE=3 (GCC 14.1, glibc 2.40),
this can happen when compressing a file with non-ASCII characters in its
UTF-8 name:

$ echo -n "There’s a Baby in the House.flac" | od -c
0000000   T   h   e   r   e 342 200 231   s       a       B   a   b   y
0000020       i   n       t   h   e       H   o   u   s   e   .   f   l
0000040   a   c
$ zip /tmp/t.zip "There’s a Baby in the House.flac"
*** buffer overflow detected ***: terminated

The problem is in local_to_wide_string, where mbstowcs is being run with
the UTF-8 source length rather than the widechar destination length --
this correctly trips a fortify error because GCC 14 can infer the actual
size of the destination.

I've attached a patch.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Santiago Vila</dc:creator><pubDate>Tue, 22 Apr 2025 22:43:37 -0000</pubDate><guid>https://sourceforge.netb7e6c5c200750024246db7c64807cb67040fb36c</guid></item></channel></rss>