|
|
|
|
|
|
|
|
|
|
xen-changelog
[Xen-changelog] [xen-unstable] [ACM] Keep stream aligned.
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 7b99b8bdbc85b532427f64b646b8091948882705
# Parent 3409c35a0b0eec7de1f2a85e4608d5b161dcef0e
[ACM] Keep stream aligned.
Signed-off-by: Tristan Gingold <tristan.gingold@xxxxxxxx>
---
tools/security/secpol_xml2bin.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff -r 3409c35a0b0e -r 7b99b8bdbc85 tools/security/secpol_xml2bin.c
--- a/tools/security/secpol_xml2bin.c Wed Oct 18 17:08:09 2006 +0100
+++ b/tools/security/secpol_xml2bin.c Wed Oct 18 17:17:15 2006 +0100
@@ -979,13 +979,15 @@ unsigned char *write_policy_reference_bi
unsigned char *buf, *ptr;
struct acm_policy_reference_buffer *pr_header;
u_int32_t len;
+ u_int32_t name_len;
if (policy_reference_name == NULL) {
printf("ERROR: No policy reference name found.\n");
exit(EXIT_FAILURE);
}
- len = (sizeof(struct acm_policy_reference_buffer) +
- strlen(policy_reference_name) + 1);
+ name_len = strlen(policy_reference_name) + 1; /* strend '\0' */
+ len = sizeof(struct acm_policy_reference_buffer) + name_len;
+ len = (len + 7) & ~7; /* Alignment. */
buf = malloc(len);
ptr = buf;
@@ -994,9 +996,9 @@ unsigned char *write_policy_reference_bi
("ERROR: out of memory allocating label reference buffer.\n");
exit(EXIT_FAILURE);
}
+ memset (buf, 0, len);
pr_header = (struct acm_policy_reference_buffer *) buf;
- pr_header->len =
- htonl(strlen(policy_reference_name) + 1 /* strend \'0' */ );
+ pr_header->len = htonl(name_len);
ptr += sizeof(struct acm_policy_reference_buffer);
strcpy((char *) ptr, policy_reference_name);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
<Prev in Thread] |
Current Thread |
[Next in Thread> |
- [Xen-changelog] [xen-unstable] [ACM] Keep stream aligned.,
Xen patchbot-unstable <=
|
|
|
|
|