[pulseaudio-commits] r2525 - /trunk/src/pulsecore/modargs.c

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Jun 13 14:07:22 PDT 2008


Author: lennart
Date: Fri Jun 13 23:07:21 2008
New Revision: 2525

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2525&root=pulseaudio&view=rev
Log:
consider passing the same argument twice to a module an error, also consider a variable name without following = an error

Modified:
    trunk/src/pulsecore/modargs.c

Modified: trunk/src/pulsecore/modargs.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/pulsecore/modargs.c?rev=2525&root=pulseaudio&r1=2524&r2=2525&view=diff
==============================================================================
--- trunk/src/pulsecore/modargs.c (original)
+++ trunk/src/pulsecore/modargs.c Fri Jun 13 23:07:21 2008
@@ -53,6 +53,12 @@
     pa_assert(key);
     pa_assert(value);
 
+    if (pa_hashmap_get(map, key)) {
+        pa_xfree(key);
+        pa_xfree(value);
+        return -1;
+    }
+
     if (valid_keys) {
         const char*const* v;
         for (v = valid_keys; *v; v++)
@@ -80,7 +86,15 @@
     map = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
 
     if (args) {
-        enum { WHITESPACE, KEY, VALUE_START, VALUE_SIMPLE, VALUE_DOUBLE_QUOTES, VALUE_TICKS } state;
+        enum {
+            WHITESPACE,
+            KEY,
+            VALUE_START,
+            VALUE_SIMPLE,
+            VALUE_DOUBLE_QUOTES,
+            VALUE_TICKS
+        } state;
+
         const char *p, *key, *value;
         size_t key_len = 0, value_len = 0;
 
@@ -100,6 +114,8 @@
                 case KEY:
                     if (*p == '=')
                         state = VALUE_START;
+                    else if (isspace(*p))
+                        goto fail;
                     else
                         key_len++;
                     break;




More information about the pulseaudio-commits mailing list