components/sbsigntool/patches/05-image_c.patch
author Jesse Butler <jesse.butler@oracle.com>
Tue, 18 Oct 2016 05:50:50 -0700
changeset 7121 02252aa4d56c
parent 6510 d00d3d1fc778
permissions -rw-r--r--
24335926 HOME should be set by default in a solaris container
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6510
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     1
# Source: Internal
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     2
# Info: Written internally to initialize buffer size and check buffer size 
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     3
# before freeing allocation. 
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     4
# Status: This patch is offered at https://bugs.launchpad.net/ubuntu/+source/sbsigntool/+bug/1588548
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     5
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     6
--- ORIGINAL/src/image.c	2016-06-14 16:11:33.636416993 -0700
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     7
+++ sbsigntool-0.6/src/image.c	2016-06-14 17:21:43.051988811 -0700
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     8
@@ -406,6 +406,7 @@
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
     9
 		goto err;
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    10
 
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    11
 reparse:
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    12
+	image->sigsize = 0;
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    13
 	rc = image_pecoff_parse(image);
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    14
 	if (rc)
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    15
 		goto err;
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    16
@@ -478,7 +479,8 @@
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    17
 	/* we only support one signature at present */
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    18
 	if (image->sigbuf) {
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    19
 		fprintf(stderr, "warning: overwriting existing signature\n");
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    20
-		talloc_free(image->sigbuf);
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    21
+		if ((int)image->sigsize > 0)
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    22
+			talloc_free(image->sigbuf);
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    23
 	}
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    24
 	image->sigbuf = sig;
d00d3d1fc778 PSARC/2016/276 sbsigntool integration
jiawliu <gerry.liu@oracle.com>
parents:
diff changeset
    25
 	image->sigsize = size;