From 99fc8282bd98a9d01429ad7520b603baf89994c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Tue, 29 May 2012 09:55:03 +0200 Subject: fix buffer overflow detection --- src/lib/eiotas_iota.c | 2 +- src/lib/eiotas_particle.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/eiotas_iota.c b/src/lib/eiotas_iota.c index 1a1f7f8..a0a4f02 100644 --- a/src/lib/eiotas_iota.c +++ b/src/lib/eiotas_iota.c @@ -40,7 +40,7 @@ int eiotas_iota_init(Eiotas_Iota *iota, const char *name, Eiotas_Iota *parent, E if(parent) { lp = eina_stringshare_strlen(parent->path); if((ln+lp+2)>EIOTAS_MAX_PATH_LENGTH) { - ERR("path length %d is > EIOTAS_MAX_PATH_LENGTH (%d)",(ln+lp+2),EIOTAS_MAX_PATH_LENGTH); + ERR("buffer overflow (%d)",(ln+lp+2)); return 1; } memcpy(tmp,parent->path,lp); diff --git a/src/lib/eiotas_particle.c b/src/lib/eiotas_particle.c index e1d8433..18fbdb5 100644 --- a/src/lib/eiotas_particle.c +++ b/src/lib/eiotas_particle.c @@ -104,8 +104,8 @@ EAPI void eiotas_particle_add_destinations(Eiotas_Particle *particle, char* dest n = (sep-dst); if(n==0) { ERR("ignore empty destination"); - } else if(n+2>EIOTAS_MAX_PATH_LENGTH) { - ERR("buffer overflow (%d)",n); + } else if(n+1>EIOTAS_MAX_PATH_LENGTH) { + ERR("buffer overflow (%d)",n+1); } else { memcpy(tmp,dst,n); tmp[n]='\0'; -- cgit v1.1-2-g2b99