[PATCH 4/5] common: xf86Configure: alloc_strlen: Allocated memory does not have space for the terminating NUL of the string

Oliver McFadden oliver.mcfadden at nokia.com
Mon Mar 15 14:46:36 PDT 2010


buffer_alloc: Called allocating function "realloc" which allocated memory dictated by parameter "len + strlen(displaySize_string)"
alloc_strlen: Allocated memory does not have space for the terminating NUL of the string
var_assign: Assigned "ptr->mon_comment" to storage allocated by "realloc(ptr->mon_comment, len + strlen(displaySize_string))"

Signed-off-by: Oliver McFadden <oliver.mcfadden at nokia.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
 hw/xfree86/common/xf86Configure.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/xfree86/common/xf86Configure.c b/hw/xfree86/common/xf86Configure.c
index d74d90b..67bf08b 100644
--- a/hw/xfree86/common/xf86Configure.c
+++ b/hw/xfree86/common/xf86Configure.c
@@ -612,7 +612,7 @@ configureDDCMonitorSection (int screennum)
 	  len = 0;
 	}
 	if ((ptr->mon_comment =
-	     realloc(ptr->mon_comment, len+strlen(displaySize_string)))) {
+	     realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) {
 	  strcpy(ptr->mon_comment + len, displaySize_string);
 	}
       }
-- 
1.6.1



More information about the xorg-devel mailing list