From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:55813) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBHqJ-0005jf-MH for qemu-devel@nongnu.org; Tue, 11 Sep 2012 00:12:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TBHqI-00089I-Gs for qemu-devel@nongnu.org; Tue, 11 Sep 2012 00:12:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51615) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TBHqI-000898-6m for qemu-devel@nongnu.org; Tue, 11 Sep 2012 00:12:54 -0400 Message-ID: <504EBA3F.9010506@redhat.com> Date: Mon, 10 Sep 2012 22:12:47 -0600 From: Eric Blake MIME-Version: 1.0 References: <1347265586-17698-1-git-send-email-xiawenc@linux.vnet.ibm.com> <1347265586-17698-3-git-send-email-xiawenc@linux.vnet.ibm.com> <504E5B34.1000604@redhat.com> <504EAF55.7020802@linux.vnet.ibm.com> In-Reply-To: <504EAF55.7020802@linux.vnet.ibm.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------enigACA3787B64A7A43B5BB5AC60" Subject: Re: [Qemu-devel] [PATCH V2 2/6] libqblock type and structure defines List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com, qemu-devel@nongnu.org, blauwirbel@gmail.com, pbonzini@redhat.com This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enigACA3787B64A7A43B5BB5AC60 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 09/10/2012 09:26 PM, Wenchao Xia wrote: >>> +#define QB_ERR_STRING_SIZE (1024) >>> +struct QBroker { >>> + /* last error */ >>> + char err_msg[QB_ERR_STRING_SIZE]; >> >> Is this fixed-width struct going to bite us in the future? Suppose I >> pass in a file name that is already 1000 bytes long; it seems like I >> might be able to get you to overflow this buffer if your error message= >> includes the name of my offending file. >> > Yes it will, thanks for mention me. The resource will always have a > limit, I guess I can just increase the size to 4k to solve the issue. A 4k limit is still an easily reachable limit. PATH_MAX is typically 4k, and it is quite possible to create and access files in a hierarchy so deep that they are longer than PATH_MAX. I still think you are better off malloc'ing a pointer than trying to claim a fixed width field solves all possible messages. --=20 Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --------------enigACA3787B64A7A43B5BB5AC60 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Mozilla - http://www.enigmail.net/ iQEcBAEBCAAGBQJQTrpAAAoJEKeha0olJ0NqCPcIAK6ZCUjrWoflxA07a7WIV0+N LDLYqAcqtuyZWLeLtPsmedk3SnkHrlkjCCoDrXYJGP1DstlHvwX3nQsd/H72qPMM vXT4Xe2jbIcKI5I8pvvpKN18QWCJZhJuQYyj+hrM8ISkgAUP+sSGnUzBPrACuhWK wUwz2d7I0ChIhPnPMQLdWodcQs3upb17inceYq1nx+YnJDO8lO5ASjkCF2owDRRw LpQzTC7Oqh5u/xg3PhseFooQvzSGsRg3Ckk1rBp5knSYBzYEGXA+YRuoWoAvj2Jo dq6H+vK6S0liUc5LKYvW367abTb8tUoTblo02Tpz6t4Opg+sLfva3CdNwN9D+bk= =JRxr -----END PGP SIGNATURE----- --------------enigACA3787B64A7A43B5BB5AC60--