Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Jul 2007 06:44:25 +0300
From:      Kostik Belousov <kostikbel@gmail.com>
To:        Alexey Tarasov <glorgster@gmail.com>
Cc:        Shteryana Shopova <syrinx@freebsd.org>, "Constantine A. Murenin" <cnst@freebsd.org>, Perforce Change Reviews <perforce@freebsd.org>, Hans Petter Selasky <hselasky@c2i.net>
Subject:   Re: PERFORCE change 123376 for review
Message-ID:  <20070713034425.GH2200@deviant.kiev.zoral.com.ua>
In-Reply-To: <db2194de0707121840i2dc5de1fj614c7b4efad7b9d7@mail.gmail.com>
References:  <200707121428.l6CESBSj045007@repoman.freebsd.org> <46965433.6050207@FreeBSD.org> <200707121831.22913.hselasky@c2i.net> <db2194de0707121840i2dc5de1fj614c7b4efad7b9d7@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--ZgsjCHEQV+PhxuqO
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Jul 13, 2007 at 12:40:38PM +1100, Alexey Tarasov wrote:
> >http://perforce.freebsd.org/chv.cgi?CH=3D123376
> >
> >Change 123376 by taleks@taleks_th on 2007/07/12 14:27:18
> >
> >@@ -104,11 +107,11 @@
> >      }
> >
> >      if ( (from =3D=3D 0) && (size =3D=3D 0) ) {
> >-             sprintf(http_data, "GET /%s HTTP/1.1\r\nHost:
> %s\r\nConnection: Close\r\n\r\n",
> >+             sprintf(http_data, "GET /%s HTTP/1.1\r\nHost:
> %s\r\nConnection: Close\r\nUser-Agent: pxe_http/0\r\n\r\n",
> >                  filename, server_name
> >              );
> >      } else {
> >-             sprintf(http_data, "GET /%s HTTP/1.1\r\nHost: %s\r\nRange:
> %d-%d\r\nConnection: Close\r\n\r\n",
> >+             sprintf(http_data, "GET /%s HTTP/1.1\r\nHost: %s\r\nRange:
> bytes=3D%d-%d\r\nConnection: Close\r\nUser-Agent: pxe_http/0\r\n\r\n",
> >                  filename, server_name, from, from + size
> >              );
> >      }
>=20
> >You might want to change long lines like these to something as follows:
> Ok, I'll make lines shorter.
> I've not found strict rule in style(9) for ");" at the end of multiple li=
nes
> of parameters in function call, and thought my variant is more simple for
> reading. Same intention is in using curly brackets in complex single
> statement in if-else block. Well, it's not big problem, I may correct this
> on next submits.
>=20
> >And, don't use "sprintf". Use "snprintf" instead.
> As for snprintf(), I'm also wanted to make it safer, but according to man
> and header file - libstand have no such function. Same for strnstr().
> I'm thinking about skipping sprintf() with many parameters while generati=
ng
> header and writing directly to socket, in such case will be more function
> calls and checks, but only  one of them (Range field, that always has
> predictable size smaller then default buffer size) will use sprintf().
Nobody will object if you add the functions to libstand.

--ZgsjCHEQV+PhxuqO
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFGlvUYC3+MBN1Mb4gRAmpKAKCGMCAZowDUEfz7K+vZ9PxdSjZXeACgtJww
W4gO0rvjnCo3yh1W0HIg0yw=
=x41T
-----END PGP SIGNATURE-----

--ZgsjCHEQV+PhxuqO--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070713034425.GH2200>