tags 525549 patch
thanks

[CCing Sam and Don this time.]

Okay, I couldn't quite reproduce this on i386 either - it will only
happen intermittently, I expect.  When I tried it, the string at (name +
pathlen + 1) seemed to be "h".  Occasionally, it might be something
strptime can parse, and then the main file would get deleted.

Here is the (as yet untested) patch that I think should fix this:

--- gnucash-2.2.9.orig/src/backend/file/gnc-backend-file.c
+++ gnucash-2.2.9/src/backend/file/gnc-backend-file.c
@@ -722,12 +722,13 @@
              continue;
 
         name = g_build_filename(be->dirname, dent, (gchar*)NULL);
-        len = strlen(name) - 4;
+        len = strlen(name);
 
         /* Is this file associated with the current data file */
-        if (strncmp(name, be->fullpath, pathlen) == 0) 
+        if ((strncmp(name, be->fullpath, pathlen) == 0) &&
+            (len > pathlen))
         {
-            if ((safe_strcmp(name + len, ".LNK") == 0) &&
+            if ((safe_strcmp(name + len - 4, ".LNK") == 0) &&
                 /* Is a lock file. Skip the active lock file */
                 (safe_strcmp(name, be->linkfile) != 0) &&
                 /* Only delete lock files older than the active one */

I'll try to get round to a delayed NMU this week after I've tested it,
if I don't hear anything.

-- 
Tim Retout <dioc...@debian.org>

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to