Skip to content

Commit

Permalink
Fix 'magic' numbers to be strlen(something)
Browse files Browse the repository at this point in the history
Signed-off-by: Jelmer Vernooij <[email protected]>
  • Loading branch information
synnack authored and jelmer committed Jun 20, 2010
1 parent e86ef68 commit d61f024
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions source4/lib/policy/gp_filesys.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ NTSTATUS gp_create_gpt(struct gp_context *gp_ctx, const char *name, const char *
int rv;
int fd;
NTSTATUS status;
const char *file_content = "[General]\r\nVersion=0\r\n";

/* Create a forked memory context, as a base for everything here */
mem_ctx = talloc_new(gp_ctx);
Expand Down Expand Up @@ -388,8 +389,8 @@ NTSTATUS gp_create_gpt(struct gp_context *gp_ctx, const char *name, const char *
return NT_STATUS_UNSUCCESSFUL;
}

rv = write(fd, "[General]\r\nVersion=0\r\n", 23);
if (rv != 23) {
rv = write(fd, file_content, strlen(file_content));
if (rv != strlen(file_content)) {
DEBUG(0, ("Short write in GPT.INI\n"));
talloc_free(mem_ctx);
return NT_STATUS_UNSUCCESSFUL;
Expand Down
5 changes: 3 additions & 2 deletions source4/lib/policy/gp_ldap.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,13 @@ static NTSTATUS parse_gplink (TALLOC_CTX *mem_ctx, const char *gplink_str, struc
int pos;
struct gp_link **gplinks;
char *buf, *end;
const char *gplink_start = "[LDAP://";

gplinks = talloc_array(mem_ctx, struct gp_link *, 1);
gplinks[0] = NULL;

/* Assuming every gPLink starts with "[LDAP://" */
start = 8;
start = strlen(gplink_start);

for (pos = start; pos < strlen(gplink_str); pos++) {
if (gplink_str[pos] == ';') {
Expand All @@ -329,7 +330,7 @@ static NTSTATUS parse_gplink (TALLOC_CTX *mem_ctx, const char *gplink_str, struc
/* Increment the array index, the string position past
the next "[LDAP://", and set the start reference */
idx++;
pos += 9;
pos += strlen(gplink_start)+1;
start = pos;
}
}
Expand Down

0 comments on commit d61f024

Please sign in to comment.