[sblim-tools-libra] Use memmove instead of strcpy when copying overlapping memory area

vcrhonek vcrhonek at fedoraproject.org
Wed May 16 11:27:52 UTC 2012


commit f9418dae85818626b5ff6e00dadcbfefdddedf3f
Author: Vitezslav Crhonek <vcrhonek at redhat.com>
Date:   Wed May 16 13:27:43 2012 +0200

    Use memmove instead of strcpy when copying overlapping memory area

 ...tools-libra-1.0-overlapping-memory-strcpy.patch |   12 ++++++++++++
 sblim-tools-libra.spec                             |    8 +++++++-
 2 files changed, 19 insertions(+), 1 deletions(-)
---
diff --git a/sblim-tools-libra-1.0-overlapping-memory-strcpy.patch b/sblim-tools-libra-1.0-overlapping-memory-strcpy.patch
new file mode 100644
index 0000000..1f333df
--- /dev/null
+++ b/sblim-tools-libra-1.0-overlapping-memory-strcpy.patch
@@ -0,0 +1,12 @@
+diff -up sblim-tools-libra-1.0/src/smt_libra_rastr.c.orig sblim-tools-libra-1.0/src/smt_libra_rastr.c
+--- sblim-tools-libra-1.0/src/smt_libra_rastr.c.orig	2012-05-16 12:58:17.531361284 +0200
++++ sblim-tools-libra-1.0/src/smt_libra_rastr.c	2012-05-16 13:03:40.123048211 +0200
+@@ -37,7 +37,7 @@ char *nonl(char *string){
+ static char *__noquotes(char *str){
+   char *ptr;
+   while ( ((ptr = strpbrk(str,"\"'")) != NULL) && *str )
+-    strcpy(ptr,ptr+1);
++    memmove(ptr,ptr+1,strlen(ptr)-1);
+   return str;
+ }
+ 
diff --git a/sblim-tools-libra.spec b/sblim-tools-libra.spec
index 1fa3333..de91303 100644
--- a/sblim-tools-libra.spec
+++ b/sblim-tools-libra.spec
@@ -1,7 +1,7 @@
 
 Name:           sblim-tools-libra
 Version:        1.0
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        SBLIM Common Resource Access Library for WBEM-SMT tasks
 
 Group:          System Environment/Libraries
@@ -10,6 +10,8 @@ URL:            http://sblim.wiki.sourceforge.net/
 Source0:        http://downloads.sourceforge.net/sblim/%{name}-%{version}.tar.bz2
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
+Patch0:         sblim-tools-libra-1.0-overlapping-memory-strcpy.patch
+
 %description
 The tools-libra package provides common functionality required by
 the task-specific resource access layers of wbem-smt tasks such as
@@ -29,6 +31,7 @@ provider packages.
 
 %prep
 %setup -q
+%patch0 -p1 -b .overlapping-memory-strcpy
 
 %build
 %ifarch s390 s390x ppc ppc64
@@ -64,6 +67,9 @@ rm -rf $RPM_BUILD_ROOT
 %postun -p /sbin/ldconfig
 
 %changelog
+* Wed May 16 2012 Vitezslav Crhonek <vcrhonek at redhat.com> - 1.0-4
+- Use memmove instead of strcpy when copying overlapping memory area
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.0-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list