lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 18 Nov 2016 05:07:47 +0900
From:   Takashi Sakamoto <o-takashi@...amocchi.jp>
To:     Takashi Iwai <tiwai@...e.de>, Joe Perches <joe@...ches.com>,
        nicolas.iooss_linux@....org
Cc:     alsa-devel <alsa-devel@...a-project.org>,
        Clemens Ladisch <clemens@...isch.de>,
        Takashi Iwai <tiwai@...e.com>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: sound: bebop: strncmp length oddity

s/bebop/bebob/
(BeBoB is 'BridgeCo enhanced Breakout Box'.)

I'm sorry to miss this post, Joe. I was busy to prepare for Audio 
mini-conference on Linux Plumber Conference. I realized that Nicolas 
posted a patch for this issue.

[alsa-devel] [PATCH 1/1] ALSA: bebob: use the right string length in 
check_audiophile_booted()
http://mailman.alsa-project.org/pipermail/alsa-devel/2016-October/114073.html

On Nov 17 2016 20:47, Takashi Iwai wrote:
> On Sat, 29 Oct 2016 23:37:00 +0200,
> Joe Perches wrote:
>>
>> 15 isn't the length of the string, is that really what's desired?
>>
>> linux/next/sound/firewire/bebob/bebop.c
>>
>> -----------------------------
>>
>> static bool
>> check_audiophile_booted(struct fw_unit *unit)
>> {
>> 	char name[24] = {0};
>>
>> 	if (fw_csr_string(unit->directory, CSR_MODEL, name, sizeof(name)) < 0)
>> 		return false;
>>
>> 	return strncmp(name, "FW Audiophile Bootloader", 15) != 0;
>> }
>
> Indeed it looks bogus.  Even "FW...." string is already 24 letters, so
> it's over name[] array size.
>
> Sakamoto-san, could you fix it properly?

It's OK just to compare first a few characters, while I left whole 
string for our information because model-specific information is easily 
lost.

For M-Audio's FireWire Audiophile, modalias of 
'ieee1394:ven00000D6Cmo00010060sp' hits this unit only. However the unit 
has two states relevant to loaded firmware. Initial firmware returns 'FW 
Audiophile Bootloader', while functional firmware returns 'FW 
Audiophile'. Just comparing the first 15 characters is the shortest way 
to defferentiate them. (Actually 14 characters. I guess that I did avoid 
comparison based on LWS...)

Therefore, changing comparison range is not for bug fix, just for 
readers. But I agree with these patches because the code is a bit 
confusing. I'll post a patch soon for this aim with appropriate 
information, sorry for Nicolas.


Thanks

Takashi Sakamoto

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ