]> code.delx.au - pulseaudio/blobdiff - src/pulsecore/namereg.c
core-util: rework pa_strlcpy() to not rely on strncpy()
[pulseaudio] / src / pulsecore / namereg.c
index ac456ac7ebed5db02574dca771d8d5f2a5d7840a..9df2f583a18936ed010e0ff696281d7760616362 100644 (file)
@@ -5,7 +5,7 @@
 
   PulseAudio is free software; you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as published
-  by the Free Software Foundation; either version 2 of the License,
+  by the Free Software Foundation; either version 2.1 of the License,
   or (at your option) any later version.
 
   PulseAudio is distributed in the hope that it will be useful, but
@@ -194,7 +194,11 @@ void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type) {
 
     }
 
-    if (*name == '@' || !name || !pa_namereg_is_valid_name(name))
+    if (!name)
+        return NULL;
+
+    if ((type == PA_NAMEREG_SINK || type == PA_NAMEREG_SOURCE || type == PA_NAMEREG_CARD) &&
+        !pa_namereg_is_valid_name(name))
         return NULL;
 
     if ((e = pa_hashmap_get(c->namereg, name)))