Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

sqldatasource dal, wwwxxxenden, convert raid5 to raid 10 mdadm, apache force chunked, nrao wwwxxx, xxxxxdup, procmail change subject header, wwwXxx not20, Wwwxxx.doks sas, linux raid resync after reboot

Links

XODOX
Impressum

#1: [mdadm PATCH 2/2] Fix unterminated buffer after readlink() call

Posted on 2011-10-13 11:22:13 by Thomas Jarosch

Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
mdopen.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/mdopen.c b/mdopen.c
index 0a17421..555ab84 100644
--- a/mdopen.c
+++ b/mdopen.c
@@ -360,8 +360,12 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,

if (lstat(chosen, &stb) == 0) {
char buf[300];
+ ssize_t link_len = readlink(chosen, buf, sizeof(buf)-1);
+ if (link_len >= 0)
+ buf[link_len] = '\0';
+
if ((stb.st_mode & S_IFMT) != S_IFLNK ||
- readlink(chosen, buf, 300) <0 ||
+ link_len < 0 ||
strcmp(buf, devname) != 0) {
fprintf(stderr, Name ": %s exists - ignoring\n",
chosen);
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Report this message

#2: Re: [mdadm PATCH 2/2] Fix unterminated buffer after readlink() call

Posted on 2011-10-17 02:19:19 by NeilBrown

--Sig_/E.mTPFTotNi.D_dTjGSC2ml
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Thu, 13 Oct 2011 11:22:13 +0200 Thomas Jarosch
<thomas.jarosch@intra2net.com> wrote:

>=20
> Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
> ---
> mdopen.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>=20
> diff --git a/mdopen.c b/mdopen.c
> index 0a17421..555ab84 100644
> --- a/mdopen.c
> +++ b/mdopen.c
> @@ -360,8 +360,12 @@ int create_mddev(char *dev, char *name, int autof, i=
nt trustworthy,
> =20
> if (lstat(chosen, &stb) == 0) {
> char buf[300];
> + ssize_t link_len =3D readlink(chosen, buf, sizeof(buf)-1);
> + if (link_len >=3D 0)
> + buf[link_len] =3D '\0';
> +
> if ((stb.st_mode & S_IFMT) !=3D S_IFLNK ||
> - readlink(chosen, buf, 300) <0 ||
> + link_len < 0 ||
> strcmp(buf, devname) !=3D 0) {
> fprintf(stderr, Name ": %s exists - ignoring\n",
> chosen);


Thanks. I've applied this and the other one.

NeilBrown


--Sig_/E.mTPFTotNi.D_dTjGSC2ml
Content-Type: application/pgp-signature; name=signature.asc
Content-Disposition: attachment; filename=signature.asc

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iQIVAwUBTpt0iDnsnt1WYoG5AQJhVxAAk+UtJthViCLCyfm30jmcCUMp4o1G SN0p
WPBMUvH3ma+Q0dj8Fre0VY0sT6OdspVEclPpvei39MZIJOZuQdXlVyBuKb+5 Ii9s
3uyPc2sMiBSyqoqsuqCmfy0QR9aCpa37VdT4RoVuy0AunY7yQbvcLy0nxFAI ig6l
8zW7c6qdSKpDF3skW3PshiNK/tEho7luGmODM92YJesvatcDmX+gQbYU7uhl jbxq
79ih/NgdY8X5hCiZySZYULJ7WulprquQGzkU7ZpYfLwzgBhI6RlqETSi0Jjd hj4E
BeScG/s2qw0NKke9UK+00F0ZCYSWWLLV8Rv+5g+8g8bmwWGi1IdHvYKPQ2Ap MHpp
dmLjMMkwq57uMmadJm32Npo9QiWPCxi/alHnG1cWnGjFViOmRT/7qoS7391v Qt2n
swnAjigRNWTTJ+RKM2RE4w0jl60vT/6B4692Kj1dko4yCRstYO4KPS2l8tY0 jTfv
1Ch5cXiXwJJyVy8edzrPszmx9B8Mz4+ACBVyUU80KE0BVnbyyiXQpMFHfiTM gXXm
+629nLKqEaDtVpuf1BCOASezLEUOWmwnZzBoxS6ak/0Irzg8G+7GhmEXHhB2 NZtJ
SfnFK4Na+WYLX8oILt/cewwbe9ij3JanzYc+zkilKXEMWqclxDzgx3M4z3kY p7f3
HvWCkSy942g=
=4f2J
-----END PGP SIGNATURE-----

--Sig_/E.mTPFTotNi.D_dTjGSC2ml--
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Report this message