summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2010-07-04 21:22:28 +0200
committerMatthias Dieter Wallnöfer <mdw@samba.org>2010-07-04 22:05:17 +0200
commit83dedef2c7b3c471d37f532f56d8eb0d45c20e51 (patch)
tree51c8bf1484e66f85fa2dc5e454af7455592fcaec /source4
parent680453a9069fc5f7c84344d702fbd9ac5819401a (diff)
downloadsamba-83dedef2c7b3c471d37f532f56d8eb0d45c20e51.tar.gz
samba-83dedef2c7b3c471d37f532f56d8eb0d45c20e51.tar.bz2
samba-83dedef2c7b3c471d37f532f56d8eb0d45c20e51.zip
s4:wb_cmd_list_groups.c - don't crash when we don't get any group at all
Diffstat (limited to 'source4')
-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;
}