GnuPG: Assert in gpgconf fails on change of keyserver option, if value includes a comma
Testing, NormalPublic

Assigned To
Authored By
timegrid
Wed, May 13, 1:45 PM

Description

I missed to properly encode a comma and ran into this:

$ echo 'keyserver:0:"ldap%3Aldap%3A389%3A%3A%3Adc=gnupg,dc=test%3A' | gpgconf --change-options gpgsm
gpgconf: Ohhhh jeeee: Assertion "*arg == '"'" in change_options_program failed (../../tools/gpgconf-comp.c:2597)
Aborted (core dumped)

Details

Version
`gpg 2.5.19 @ linux`

Revisions and Commits

Event Timeline

timegrid triaged this task as Normal priority.Wed, May 13, 1:45 PM
timegrid created this task.
timegrid created this object with edit policy "Contributor (Project)".

option_check_validity should check the parsing error, or we can change the assertion to return an error:

diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
index 862ebd16d..82707b38b 100644
--- a/tools/gpgconf-comp.c
+++ b/tools/gpgconf-comp.c
@@ -2594,7 +2594,12 @@ change_options_program (gc_component_id_t component,
 
                   if (!verbatim)
                     {
-                      log_assert (*arg == '"');
+                      if (*arg != '"')
+                        {
+                          gpg_err_set_errno (EINVAL);
+                          goto change_one_err;
+                        }
+
                       arg++;
 
                       end = strchr (arg, ',');
gniibe mentioned this in Unknown Object (Maniphest Task).Mon, Jun 1, 3:26 AM
gniibe changed the task status from Open to Testing.Tue, Jun 2, 4:03 AM
gniibe claimed this task.