Testckpt assumes that the data in the checkpoint section is null
terminated, when in fact the length is set to 13 (which doesn't include
a null terminator).  this change copies the section id to an array for
proper printing by copying based on the id length and then null
terminating.

Regards
-steve
Index: test/testckpt.c
===================================================================
--- test/testckpt.c	(revision 1842)
+++ test/testckpt.c	(working copy)
@@ -198,6 +198,14 @@
 	0
 };
 
+static char *print_section_id (SaCkptSectionIdT *section_id)
+{
+	static char ret_buf[128];
+	memcpy (ret_buf, section_id->id, section_id->idLen);
+	ret_buf[section_id->idLen] = '\0';
+	return (ret_buf);
+}
+
 int main (void) {
 	SaCkptHandleT ckptHandle;
 	SaCkptCheckpointHandleT checkpointHandle2;
@@ -539,7 +547,7 @@
 		}
 		if (error == SA_AIS_OK) {
 			printf ("Section '%s' expires %llx size %llu state %x update %llx\n",
-				sectionDescriptor.sectionId.id,
+				print_section_id (&sectionDescriptor.sectionId),
 				(unsigned long long)sectionDescriptor.expirationTime,
 				(unsigned long long)sectionDescriptor.sectionSize,
 				sectionDescriptor.sectionState,
_______________________________________________
Openais mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to