diff options
Diffstat (limited to 'src/providers/ldap')
-rw-r--r-- | src/providers/ldap/ldap_child.c | 14 | ||||
-rw-r--r-- | src/providers/ldap/sdap_child_helpers.c | 22 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/providers/ldap/ldap_child.c b/src/providers/ldap/ldap_child.c index 0d34be2c..069fbcfe 100644 --- a/src/providers/ldap/ldap_child.c +++ b/src/providers/ldap/ldap_child.c @@ -51,7 +51,7 @@ static errno_t unpack_buffer(uint8_t *buf, size_t size, DEBUG(7, ("total buffer size: %d\n", size)); /* realm_str size and length */ - COPY_UINT32_CHECK(&len, buf + p, p, size); + SAFEALIGN_COPY_UINT32_CHECK(&len, buf + p, size, &p); DEBUG(7, ("realm_str size: %d\n", len)); if (len) { @@ -63,7 +63,7 @@ static errno_t unpack_buffer(uint8_t *buf, size_t size, } /* princ_str size and length */ - COPY_UINT32_CHECK(&len, buf + p, p, size); + SAFEALIGN_COPY_UINT32_CHECK(&len, buf + p, size, &p); DEBUG(7, ("princ_str size: %d\n", len)); if (len) { @@ -75,7 +75,7 @@ static errno_t unpack_buffer(uint8_t *buf, size_t size, } /* keytab_name size and length */ - COPY_UINT32_CHECK(&len, buf + p, p, size); + SAFEALIGN_COPY_UINT32_CHECK(&len, buf + p, size, &p); DEBUG(7, ("keytab_name size: %d\n", len)); if (len) { @@ -92,19 +92,19 @@ static errno_t unpack_buffer(uint8_t *buf, size_t size, static int pack_buffer(struct response *r, int result, const char *msg) { int len; - int p = 0; + size_t p = 0; len = strlen(msg); r->size = 2 * sizeof(uint32_t) + len; /* result */ - COPY_UINT32_VALUE(&r->buf[p], result, p); + SAFEALIGN_SET_UINT32(&r->buf[p], result, &p); /* message size */ - COPY_UINT32_VALUE(&r->buf[p], len, p); + SAFEALIGN_SET_UINT32(&r->buf[p], len, &p); /* message itself */ - COPY_MEM(&r->buf[p], msg, p, len); + safealign_memcpy(&r->buf[p], msg, len, &p); return EOK; } diff --git a/src/providers/ldap/sdap_child_helpers.c b/src/providers/ldap/sdap_child_helpers.c index 0a95c8a0..273fc678 100644 --- a/src/providers/ldap/sdap_child_helpers.c +++ b/src/providers/ldap/sdap_child_helpers.c @@ -166,26 +166,26 @@ static errno_t create_tgt_req_send_buffer(TALLOC_CTX *mem_ctx, /* realm */ if (realm_str) { - COPY_UINT32_VALUE(&buf->data[rp], strlen(realm_str), rp); - COPY_MEM(&buf->data[rp], realm_str, rp, strlen(realm_str)); + SAFEALIGN_SET_UINT32(&buf->data[rp], strlen(realm_str), &rp); + safealign_memcpy(&buf->data[rp], realm_str, strlen(realm_str), &rp); } else { - COPY_UINT32_VALUE(&buf->data[rp], 0, rp); + SAFEALIGN_SET_UINT32(&buf->data[rp], 0, &rp); } /* principal */ if (princ_str) { - COPY_UINT32_VALUE(&buf->data[rp], strlen(princ_str), rp); - COPY_MEM(&buf->data[rp], princ_str, rp, strlen(princ_str)); + SAFEALIGN_SET_UINT32(&buf->data[rp], strlen(princ_str), &rp); + safealign_memcpy(&buf->data[rp], princ_str, strlen(princ_str), &rp); } else { - COPY_UINT32_VALUE(&buf->data[rp], 0, rp); + SAFEALIGN_SET_UINT32(&buf->data[rp], 0, &rp); } /* keytab */ if (keytab_name) { - COPY_UINT32_VALUE(&buf->data[rp], strlen(keytab_name), rp); - COPY_MEM(&buf->data[rp], keytab_name, rp, strlen(realm_str)); + SAFEALIGN_SET_UINT32(&buf->data[rp], strlen(keytab_name), &rp); + safealign_memcpy(&buf->data[rp], keytab_name, strlen(realm_str), &rp); } else { - COPY_UINT32_VALUE(&buf->data[rp], 0, rp); + SAFEALIGN_SET_UINT32(&buf->data[rp], 0, &rp); } *io_buf = buf; @@ -202,10 +202,10 @@ static int parse_child_response(TALLOC_CTX *mem_ctx, char *ccn; /* operation result code */ - COPY_UINT32_CHECK(&res, buf + p, p, size); + SAFEALIGN_COPY_UINT32_CHECK(&res, buf + p, size, &p); /* ccache name size */ - COPY_UINT32_CHECK(&len, buf + p, p, size); + SAFEALIGN_COPY_UINT32_CHECK(&len, buf + p, size, &p); if ((p + len ) > size) return EINVAL; |