components/sbsigntool/patches/05-image_c.patch
changeset 6510 d00d3d1fc778
equal deleted inserted replaced
6509:d45542b6400a 6510:d00d3d1fc778
       
     1 # Source: Internal
       
     2 # Info: Written internally to initialize buffer size and check buffer size 
       
     3 # before freeing allocation. 
       
     4 # Status: This patch is offered at https://bugs.launchpad.net/ubuntu/+source/sbsigntool/+bug/1588548
       
     5 
       
     6 --- ORIGINAL/src/image.c	2016-06-14 16:11:33.636416993 -0700
       
     7 +++ sbsigntool-0.6/src/image.c	2016-06-14 17:21:43.051988811 -0700
       
     8 @@ -406,6 +406,7 @@
       
     9  		goto err;
       
    10  
       
    11  reparse:
       
    12 +	image->sigsize = 0;
       
    13  	rc = image_pecoff_parse(image);
       
    14  	if (rc)
       
    15  		goto err;
       
    16 @@ -478,7 +479,8 @@
       
    17  	/* we only support one signature at present */
       
    18  	if (image->sigbuf) {
       
    19  		fprintf(stderr, "warning: overwriting existing signature\n");
       
    20 -		talloc_free(image->sigbuf);
       
    21 +		if ((int)image->sigsize > 0)
       
    22 +			talloc_free(image->sigbuf);
       
    23  	}
       
    24  	image->sigbuf = sig;
       
    25  	image->sigsize = size;