Package: yafc
Version: 1.1.1.dfsg.1-4
Severity: normal
Tags: patch
--- Please enter the report below this line. ---
Hi,
Since a few months I've noticed that yafc uploads files with a wrong
name. For example a file named 'IMG_0301.JPG' will be renamed as
'IMG_0001.JPG'.
This is due to a wrong usage of the strcpy function. strcpy cannot be
used with source and destination overlapping. With optimized
implementations this might led to inconsistencies.
Please find a patched attached.
Regards,
--
Lionel Landwerlin
--- System information. ---
Architecture: amd64
Kernel: Linux 2.6.32-4-amd64
Debian Release: squeeze/sid
500 unstable ftp.fr.debian.org
1 experimental ftp.fr.debian.org
--- Package information. ---
Depends (Version) | Installed
====================================-+-====================
libc6 (>= 2.7-1) | 2.11.2-6
libncurses5 (>= 5.6+20071006-3) | 5.7+20100313-4
libreadline5 (>= 5.2) | 5.2-7
Package's Recommends field is empty.
Package's Suggests field is empty.
>From da8487d7794b0239e12121e70c45628a08c35f32 Mon Sep 17 00:00:00 2001
From: Lionel Landwerlin <[email protected]>
Date: Sun, 21 Nov 2010 04:33:44 +0100
Subject: [PATCH] strpull: fix wrong usage of strcpy
strcpy cannot be used with source and destination overlapping, with
optimized implementations this might led to inconsistencies.
Signed-off-by: Lionel Landwerlin <[email protected]>
---
src/libmhe/strq.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/libmhe/strq.c b/src/libmhe/strq.c
index 00b51c7..f303d84 100644
--- a/src/libmhe/strq.c
+++ b/src/libmhe/strq.c
@@ -96,9 +96,11 @@ void strpush(char *s, int n)
void strpull(char *s, int n)
{
- if(n > strlen(s))
+ int l = strlen(s);
+
+ if(n > l)
n = strlen(s);
- strcpy(s, s+n);
+ memmove(s, s+n, l-n+1);
}
/* returns number of C in STR */
--
1.7.2.3