79 lines
2.6 KiB
Plaintext
79 lines
2.6 KiB
Plaintext
$OpenBSD: patch-Imlib_utils_c,v 1.3 2009/01/09 16:21:42 naddy Exp $
|
|
--- Imlib/utils.c.orig Fri Mar 22 15:43:04 2002
|
|
+++ Imlib/utils.c Fri Jan 9 17:20:41 2009
|
|
@@ -801,6 +801,7 @@ Imlib_crop_and_clone_image(ImlibData * id, ImlibImage
|
|
unsigned char *ptr1, *ptr2;
|
|
ImlibImage *im2;
|
|
char *s;
|
|
+ size_t s_size;
|
|
|
|
if (!im)
|
|
return NULL;
|
|
@@ -872,10 +873,11 @@ Imlib_crop_and_clone_image(ImlibData * id, ImlibImage
|
|
im2->rgb_width = w;
|
|
im2->rgb_height = h;
|
|
im2->alpha_data = NULL;
|
|
- s = malloc(strlen(im->filename) + 320);
|
|
+ s_size = strlen(im->filename + 320);
|
|
+ s = malloc(s_size);
|
|
if (s)
|
|
{
|
|
- snprintf(s, sizeof(s), "%s_%x_%x", im->filename, (int)time(NULL), (int)rand());
|
|
+ snprintf(s, s_size, "%s_%x_%x", im->filename, (int)time(NULL), (int)rand());
|
|
im2->filename = malloc(strlen(s) + 1);
|
|
if (im2->filename)
|
|
strcpy(im2->filename, s);
|
|
@@ -1211,6 +1213,7 @@ Imlib_clone_image(ImlibData * id, ImlibImage * im)
|
|
{
|
|
ImlibImage *im2;
|
|
char *s;
|
|
+ size_t s_size;
|
|
|
|
if (!im)
|
|
return NULL;
|
|
@@ -1239,10 +1242,11 @@ Imlib_clone_image(ImlibData * id, ImlibImage * im)
|
|
}
|
|
else
|
|
im2->alpha_data = NULL;
|
|
- s = malloc(strlen(im->filename) + 320);
|
|
+ s_size = strlen(im->filename) + 320;
|
|
+ s = malloc(s_size);
|
|
if (s)
|
|
{
|
|
- snprintf(s, sizeof(s), "%s_%x_%x", im->filename, (int)time(NULL), (int)rand());
|
|
+ snprintf(s, s_size, "%s_%x_%x", im->filename, (int)time(NULL), (int)rand());
|
|
im2->filename = malloc(strlen(s) + 1);
|
|
if (im2->filename)
|
|
strcpy(im2->filename, s);
|
|
@@ -1285,6 +1289,7 @@ Imlib_clone_scaled_image(ImlibData * id, ImlibImage *
|
|
{
|
|
ImlibImage *im2;
|
|
char *s;
|
|
+ size_t s_size;
|
|
|
|
if ((!im) || (w <= 0) || (h <= 0))
|
|
return NULL;
|
|
@@ -1417,10 +1422,11 @@ Imlib_clone_scaled_image(ImlibData * id, ImlibImage *
|
|
}
|
|
else
|
|
im2->alpha_data = NULL;
|
|
- s = malloc(strlen(im->filename) + 320);
|
|
+ s_size = strlen(im->filename) + 320;
|
|
+ s = malloc(s_size);
|
|
if (s)
|
|
{
|
|
- snprintf(s, sizeof(s), "%s_%x_%x_%x_%x", im->filename, (int)time(NULL), w, h, (int)rand());
|
|
+ snprintf(s, s_size, "%s_%x_%x_%x_%x", im->filename, (int)time(NULL), w, h, (int)rand());
|
|
im2->filename = malloc(strlen(s) + 1);
|
|
if (im2->filename)
|
|
strcpy(im2->filename, s);
|
|
@@ -1596,7 +1602,7 @@ Imlib_create_image_from_xpm_data(ImlibData * id, char
|
|
{
|
|
if (line[k] != ' ')
|
|
{
|
|
- sscanf(&line[k], "%65536s", s);
|
|
+ sscanf(&line[k], "%255s", s);
|
|
k += strlen(s);
|
|
if (!strcmp(s, "c"))
|
|
iscolor = 1;
|