openbsd-ports/audio/sox/patches/patch-src_smp_c
naddy ffbb62be15 * make sox work on platforms where char defaults to unsigned
* sprintf -> snprintf, and opportunistically get rid of some strcpy()s

From: Matthias Kilian <kili@outback.escape.de>
2005-07-02 16:27:56 +00:00

29 lines
1.3 KiB
Plaintext

$OpenBSD: patch-src_smp_c,v 1.1 2005/07/02 16:27:56 naddy Exp $
--- src/smp.c.orig Tue Sep 28 04:33:09 2004
+++ src/smp.c Fri Jun 24 12:49:38 2005
@@ -249,8 +249,9 @@ int st_smpstartread(ft_t ft)
for (commentlen = COMMENTLEN-1;
commentlen >= 0 && header.comments[commentlen] == ' '; commentlen--)
;
- sprintf(smp->comment, "%.*s: %.*s", namelen+1, header.name,
- commentlen+1, header.comments);
+ snprintf(smp->comment, sizeof(smp->comment),
+ "%.*s: %.*s", namelen+1, header.name,
+ commentlen+1, header.comments);
ft->comment = smp->comment;
st_report("SampleVision file name and comments: %s", ft->comment);
@@ -380,8 +381,10 @@ int st_smpstartwrite(ft_t ft)
strcpy(header.Id, SVmagic);
strcpy(header.version, SVvers);
- sprintf(header.comments, "%-*s", COMMENTLEN, "Converted using Sox.");
- sprintf(header.name, "%-*.*s", NAMELEN, NAMELEN, ft->comment);
+ snprintf(header.comments, sizeof(header.comments),
+ "%-*s", COMMENTLEN, "Converted using Sox.");
+ snprintf(header.name, sizeof(header.name),
+ "%-*.*s", NAMELEN, NAMELEN, ft->comment);
/* Write file header */
if(st_write(ft, &header, 1, HEADERSIZE) != HEADERSIZE)