openbsd-ports/graphics/scrot/patches/patch-src_options_c
robert e6efa5c7a2 Import of scrot-0.8
scrot is a commandline screen capture util like "import", but using
imlib2. It has lots of options for autogenerating filenames, and can
do fun stuff like taking screenshots of multiple displays and glueing
them together.

from Victor Sahlstedt <cvss@home.se>; ok naddy@
2004-07-01 21:53:16 +00:00

27 lines
763 B
Plaintext

$OpenBSD: patch-src_options_c,v 1.1.1.1 2004/07/01 21:53:16 robert Exp $
--- src/options.c.orig Mon Jun 23 14:09:08 2003
+++ src/options.c Thu Jul 1 23:22:32 2004
@@ -141,6 +141,7 @@
length = strlen(name) + 7;
new_title = gib_emalloc(length);
+ memset(new_title, 0, sizeof(new_title));
dot_pos = strrchr(name, '.');
if (dot_pos)
@@ -148,11 +149,11 @@
diff = (dot_pos - name) / sizeof(char);
strncpy(new_title, name, diff);
- strcat(new_title, "-thumb");
- strcat(new_title, dot_pos);
+ strlcat(new_title, "-thumb", length);
+ strlcat(new_title, dot_pos, length);
}
else
- sprintf(new_title, "%s-thumb", name);
+ snprintf(new_title, length, "%s-thumb", name);
return new_title;
}