[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Disallow empty tag name as target for rename.



Using  hc rename default ''  or similiar it was possible to create an
empty tag which should be prevented, the attached patch fixes this.

-- 
() ascii ribbon campaign - stop html mail    www.asciiribbon.org
/\ www.the-compiler.org  | I love long mails http://email.is-not-s.ms/
When the bosses talk about improving productivity, they are never talking 
about themselves. 
From f701fe77f486d1e9016d78e48ab21b6f016b1d83 Mon Sep 17 00:00:00 2001
From: Florian Bruhin <git _at_ the _minus_ compiler _dot_ org>
Date: Tue, 20 May 2014 15:14:12 +0200
Subject: [PATCH] Disallow empty tag name as target for rename.

---
 src/tag.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/tag.c b/src/tag.c
index 483495b..e15460e 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -272,6 +272,11 @@ int tag_rename_command(int argc, char** argv, GString* 
output) {
     if (argc < 3) {
         return HERBST_NEED_MORE_ARGS;
     }
+    if (!strcmp("", argv[2])) {
+        g_string_append_printf(output,
+            "%s: An empty tag name is not permitted\n", argv[0]);
+        return HERBST_INVALID_ARGUMENT;
+    }
     HSTag* tag = find_tag(argv[1]);
     if (!tag) {
         g_string_append_printf(output,
-- 
1.9.2

Attachment: pgp6U4zFWCz1P.pgp
Description: PGP signature