ffbb62be15
* sprintf -> snprintf, and opportunistically get rid of some strcpy()s From: Matthias Kilian <kili@outback.escape.de>
34 lines
1.3 KiB
Plaintext
34 lines
1.3 KiB
Plaintext
$OpenBSD: patch-src_trim_c,v 1.1 2005/07/02 16:27:56 naddy Exp $
|
|
--- src/trim.c.orig Tue Sep 28 04:33:09 2004
|
|
+++ src/trim.c Fri Jun 24 10:50:35 2005
|
|
@@ -46,13 +46,12 @@ int st_trim_getopts(eff_t effp, int n, c
|
|
*/
|
|
switch (n) {
|
|
case 2:
|
|
- trim->length_str = (char *)malloc(strlen(argv[1])+1);
|
|
+ trim->length_str = strdup(argv[1]);
|
|
if (!trim->length_str)
|
|
{
|
|
st_fail("Could not allocate memory");
|
|
return(ST_EOF);
|
|
}
|
|
- strcpy(trim->length_str,argv[1]);
|
|
/* Do a dummy parse to see if it will fail */
|
|
if (st_parsesamples(0, trim->length_str,
|
|
&trim->length, 't') != ST_SUCCESS)
|
|
@@ -61,13 +60,12 @@ int st_trim_getopts(eff_t effp, int n, c
|
|
return(ST_EOF);
|
|
}
|
|
case 1:
|
|
- trim->start_str = (char *)malloc(strlen(argv[0])+1);
|
|
+ trim->start_str = strdup(argv[0]);
|
|
if (!trim->start_str)
|
|
{
|
|
st_fail("Could not allocate memory");
|
|
return(ST_EOF);
|
|
}
|
|
- strcpy(trim->start_str,argv[0]);
|
|
/* Do a dummy parse to see if it will fail */
|
|
if (st_parsesamples(0, trim->start_str,
|
|
&trim->start, 't') != ST_SUCCESS)
|