summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/winbind/wb_cmd_list_groups.c6
1 files changed, 4 insertions, 2 deletions
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;
}