On 2011-01-12 at 16:32:17 [+0100], John Scipione <jscipione@xxxxxxxxx> wrote: > On Jan 12, 2011, at 9:28 AM, zooey@xxxxxxxxxxxxxxx wrote: > > Author: zooey > > Date: 2011-01-12 15:28:58 +0100 (Wed, 12 Jan 2011) > > New Revision: 40212 > > Changeset: http://dev.haiku-os.org/changeset/40212 > > > > Modified: > > haiku/trunk/src/bin/package/PackageWriter.cpp > > Log: > > * fix check in PackageWriter against ".." > > > > Modified: haiku/trunk/src/bin/package/PackageWriter.cpp > > =================================================================== > > --- haiku/trunk/src/bin/package/PackageWriter.cpp 2011-01-12 > > 12:43:13 UTC (rev 40211) > > +++ haiku/trunk/src/bin/package/PackageWriter.cpp 2011-01-12 > > 14:28:58 UTC (rev 40212) > > @@ -746,8 +746,8 @@ > > size_t nameLength, bool isImplicit) > > { > > // check the component name -- don't allow "." or ".." > > - if (*name == '.' > > - && (nameLength == 1 || (nameLength == 2 && name[2] == > > '.'))) { > > + if (name[0] == '.' > > + && (nameLength == 1 || (nameLength == 2 && name[1] == > > '.'))) { > > Shouldn't that be: > > if ((nameLength == 1 && name[0] == '.') > || (nameLength == 2 && name[0] == '.' && name[1] == '.')) { > > ? Pendantic I know but better I think. Since it's a null-terminated C string, accessing index 0 is always valid. To be honest, it's a somewhat silly optimization anyway, but two strcmp()s for those simple checks felt like overkill. Though, if one doesn't even get them right... CU, Ingo