[dia] [warningectomy] integer overflow in expression
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [warningectomy] integer overflow in expression
- Date: Sat, 4 May 2013 18:59:35 +0000 (UTC)
commit 30a3526f20de63163240b48d875eb59817e67864
Author: Hans Breuer <hans breuer org>
Date: Sat May 4 12:24:37 2013 +0200
[warningectomy] integer overflow in expression
Checking for special directory entries was a bit too
complicated for my and gcc's taste. (IIRC the case
does not happen anymore with GDir anyway.)
lib/plug-ins.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/lib/plug-ins.c b/lib/plug-ins.c
index 87ae62b..6eaae63 100644
--- a/lib/plug-ins.c
+++ b/lib/plug-ins.c
@@ -317,12 +317,11 @@ for_each_in_dir(const gchar *directory, ForEachInDirDoFunc dofunc,
static gboolean
directory_filter(const gchar *name)
{
- guint len = strlen(name);
-
- if (0 == strcmp(G_DIR_SEPARATOR_S ".",
- &name[len-strlen(G_DIR_SEPARATOR_S ".")])) return FALSE;
- if (0 == strcmp(G_DIR_SEPARATOR_S "..",
- &name[len-strlen(G_DIR_SEPARATOR_S "..")])) return FALSE;
+ const char *rslash = strrchr(name, G_DIR_SEPARATOR);
+
+ if (rslash && ( 0 == strcmp(rslash, G_DIR_SEPARATOR_S ".")
+ || 0 == strcmp(rslash, G_DIR_SEPARATOR_S "..")))
+ return FALSE;
if (!g_file_test (name, G_FILE_TEST_IS_DIR))
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]