From: Matthias Dieter Wallnöfer Date: Sun, 4 Jul 2010 19:22:28 +0000 (+0200) Subject: s4:wb_cmd_list_groups.c - don't crash when we don't get any group at all X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=83dedef2c7b3c471d37f532f56d8eb0d45c20e51;p=kamenim%2Fsamba.git s4:wb_cmd_list_groups.c - don't crash when we don't get any group at all --- diff --git a/source4/winbind/wb_cmd_list_groups.c b/source4/winbind/wb_cmd_list_groups.c index 37fe94a5de..16059ea4cc 100644 --- a/source4/winbind/wb_cmd_list_groups.c +++ b/source4/winbind/wb_cmd_list_groups.c @@ -154,9 +154,11 @@ static void cmd_list_groups_recv_group_list(struct composite_context *ctx) /* If the status is OK, we're finished, there's no more groups. * So we'll trim off the trailing ',' and are done.*/ if (NT_STATUS_IS_OK(status)) { - int str_len = strlen(state->result); + size_t str_len = strlen(state->result); DEBUG(5, ("list_GroupList_recv returned NT_STATUS_OK\n")); - state->result[str_len - 1] = '\0'; + if (str_len > 0) { + state->result[str_len - 1] = '\0'; + } composite_done(state->ctx); return; }