Fix segfault in to_real_path
authorNikolas Garofil <garo@garox.garofil.be>
Mon, 29 Jun 2009 14:04:00 +0000 (16:04 +0200)
committerNikolas Garofil <garo@garox.garofil.be>
Mon, 29 Jun 2009 14:04:00 +0000 (16:04 +0200)
ChangeLog
src/common.c

index da36cdd..15c554a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-06-29
+       * Fix segfault in to_real_path, it's sometimes called with the same
+       source and dest without checking the length, causing a segfault.
+
 2009-06-20
        * Use the internal process list for if_running on Linux
 
index 5947384..721c10b 100644 (file)
@@ -93,7 +93,7 @@ void to_real_path(char *dest, const char *source)
                        ERR("$HOME environment variable doesn't exist");
                        strncpy(dest, source, DEFAULT_TEXT_BUFFER_SIZE);
                }
-       } else {
+       } else if (dest != source) {    //see changelog 2009-06-29 if you doubt that this check is necessary 
                strncpy(dest, source, DEFAULT_TEXT_BUFFER_SIZE);
        }
 }