public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Kernel development list <linux-kernel@vger.kernel.org>,
	USB list <linux-usb@vger.kernel.org>
Subject: Re: NLS: utf8 conversions
Date: Tue, 28 Apr 2009 08:51:02 +0200	[thread overview]
Message-ID: <49F6A756.7070203@ladisch.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0904271144330.10904-100000@iolanthe.rowland.org>

Alan Stern wrote:
> Your comments agree pretty well with what I had concluded.  However a 
> lot of the source files have lengthy tables of wchar_t values; changing 
> them to 32 bits would waste a lot of space.
> 
> As a sort of compromise, I came up with this patch (not tested yet,
> although it compiles okay).  How does it look to you?

>From a not-having-it-tested-either perspective, it looks good.

> +utf8_to_utf32(unicode_t *p, const u8 *s, int n)
> +utf32_to_utf8(u8 *s, unicode_t u, int maxlen)
> +utf8s_to_utf16s(wchar_t *pwcs, const u8 *s, int n)
> +utf16s_to_utf8s(u8 *s, const wchar_t *pwcs, int maxlen, int inlen,

Minor nitpick: You already have enhanced the insane parameter ordering
of wcsntombs_be(), but the meaning of all these functions' parameters
would be even more obvious if the buffer size would immediately follow
the corresponding buffer pointer.

Anyway,
Acked-by: Clemens Ladisch <clemens@ladisch.de>


> +++ usb-2.6/fs/isofs/joliet.c
> ...
> -static int
> -wcsntombs_be(__u8 *s, const __u8 *pwcs, int inlen, int maxlen)
> -{
> ...
> -		} else {
> -			*op++ = (__u8) c;
> -		}

Just for the record: this function had the same buffer overflow bug as
utf8_wcstombs(), but it wasn't exploitable either.


Best regards,
Clemens

  reply	other threads:[~2009-04-28  6:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-24 20:02 NLS: utf8 conversions Alan Stern
2009-04-27  8:09 ` Clemens Ladisch
2009-04-27 15:51   ` Alan Stern
2009-04-28  6:51     ` Clemens Ladisch [this message]
2009-04-28 15:51       ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49F6A756.7070203@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox