[Spice-devel] [PATCH libcacard 1/2] nss: report error on invalid db= argument

Marc-André Lureau marcandre.lureau at gmail.com
Thu Mar 3 00:58:16 UTC 2016


The db argument must end with " or \n.

Found thanks to clang scan-build.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
Reported-by: Miroslav Rezanina <mrezanin at redhat.com>
---
 src/vcard_emul_nss.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/vcard_emul_nss.c b/src/vcard_emul_nss.c
index 08a60c6..156a916 100644
--- a/src/vcard_emul_nss.c
+++ b/src/vcard_emul_nss.c
@@ -1266,6 +1266,10 @@ vcard_emul_options(const char *args)
             args++;
             db = args;
             args = strpbrk(args, "\"\n");
+            if (args == NULL) {
+              fprintf(stderr, "Error: invalid db argument.\n");
+              return NULL;
+            }
             opts->nss_db = g_strndup(db, args-db);
             if (*args != 0) {
                 args++;
-- 
2.5.0



More information about the Spice-devel mailing list