nsswitch: make the wbcSidsToUnixIds() parser more robust
authorAndrew Tridgell <tridge@samba.org>
Tue, 26 Jul 2011 01:01:36 +0000 (11:01 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 8 Sep 2011 13:09:54 +0000 (15:09 +0200)
this allows it to handle new types of responses

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

nsswitch/libwbclient/wbc_idmap.c

index ad3cfe67709adcc5cca120c5dc66030d76bb3a59..5325dbe5ce531680afc23e3f1c53be9d6847e1f2 100644 (file)
@@ -372,10 +372,10 @@ wbcErr wbcSidsToUnixIds(const struct wbcDomainSid *sids, uint32_t num_sids,
                        break;
                default:
                        id->type = WBC_ID_TYPE_NOT_SPECIFIED;
-                       q = p;
+                       q = strchr(p, '\n');
                        break;
                };
-               if (q[0] != '\n') {
+               if (q == NULL || q[0] != '\n') {
                        goto wbc_err_invalid;
                }
                p = q+1;