[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdelibs/kdecore
From:       Oswald Buddenhagen <ossi () kde ! org>
Date:       2003-11-01 2:41:16
[Download RAW message or body]

On Fri, Oct 31, 2003 at 11:43:35PM +0100, David Faure wrote:
> On Friday 31 October 2003 23:05, Oswald Buddenhagen wrote:
> > @@ -1785,5 +1785,5 @@ void KURL::setDirectory( const QString &
> >  void KURL::setQuery( const QString &_txt, int encoding_hint)
> >  {
> > -   if (_txt.length() && (_txt[0] =='?'))
> > +   if (_txt[0] == '?')
> >        _setQuery( _txt.mid(1), encoding_hint );
> >     else
> 
> Why?
> Isn't this going to go out-of-bounds with an empty string in _txt?
> 
qt/src/tools/qstring.h
class QString {
  ...
  QChar at( uint i ) const
      { return i < d->len ? d->unicode[i] : QChar::null; }
  QChar operator[]( int i ) const { return at((uint)i); }
  ...
};
in case of doubt, rtfm. :)

greetings

-- 
Hi! I'm a .signature virus! Copy me into your ~/.signature, please!
--
Chaos, panic, and disorder - my work here is done.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic