gap-dev-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gap-dev-discuss] Cynthiune : fix a string comparison


From: Riccardo Mottola
Subject: Re: [Gap-dev-discuss] Cynthiune : fix a string comparison
Date: Fri, 04 May 2012 09:23:36 +0200
User-agent: Mozilla/5.0 (X11; NetBSD i386; rv:11.0) Gecko/20120409 Thunderbird/11.0

Hi,

I think it is overkill and I commited Philippe's version.

However, the old version might have worked, if both strings were constants. I'm unsure of the case here, but better go on the safe side, it is not performance critical code.

Riccardo

On 05/04/12 08:30, Sebastian Reitenbach wrote:

On Thursday, May 3, 2012 19:56 CEST, Philippe Roussel<address@hidden>  wrote:

Hi,

The code looks stupid :
Right, that seems to be stupid, but I was wondering whether stcmp
might be prone to buffer overflows, but after thinking a bit about it,
I don't think so. But maybe using strncmp to be on the safe side
might still be better?

Haven't tested, but maybe:
if !(strncmp(commentTag, ID3_FRAME_GENRE, 
strlen(commentTag)>strlen(ID3_FRAME_GENRE)?strlen(ID3_FRAME_GENRE):strlen(commentTag)))

Or might be overkill?

Sebastian






reply via email to

[Prev in Thread] Current Thread [Next in Thread]