vp-build/srcpkgs/csound/patches/musl-strncpy.patch
Jürgen Buchmüller e36e8652cf
csound: fix musl, license, homepage; revbump
Signed-off-by: Jürgen Buchmüller <pullmoll@t-online.de>
2018-09-24 21:24:19 +02:00

96 lines
3.2 KiB
Diff

--- Engine/csound_orc_semantics.c.orig 2018-09-24 20:32:36.504698465 +0200
+++ Engine/csound_orc_semantics.c 2018-09-24 20:33:24.792695587 +0200
@@ -70,7 +70,7 @@
retVal = csound->Malloc(csound, len + 1);
if (len > 0) {
- strncpy(retVal, str, len);
+ memcpy(retVal, str, len);
}
retVal[len] = '\0';
@@ -389,8 +389,8 @@
len2 = strlen(argTypeRight);
inArgTypes = csound->Malloc(csound, len1 + len2 + 1);
- strncpy(inArgTypes, argTypeLeft, len1);
- strncpy(inArgTypes + len1, argTypeRight, len2);
+ memcpy(inArgTypes, argTypeLeft, len1);
+ memcpy(inArgTypes + len1, argTypeRight, len2);
inArgTypes[len1 + len2] = '\0';
@@ -447,8 +447,8 @@
len2 = strlen(argTypeRight);
inArgTypes = csound->Malloc(csound, len1 + len2 + 1);
- strncpy(inArgTypes, argTypeLeft, len1);
- strncpy(inArgTypes + len1, argTypeRight, len2);
+ memcpy(inArgTypes, argTypeLeft, len1);
+ memcpy(inArgTypes + len1, argTypeRight, len2);
inArgTypes[len1 + len2] = '\0';
--- util1/csd_util/cs.c.orig 2018-09-24 20:42:03.578664665 +0200
+++ util1/csd_util/cs.c 2018-09-24 20:44:51.364654664 +0200
@@ -112,7 +112,7 @@
strcpy(dir, "./");
#endif
else {
- strncpy(dir, fullname, m + 1);
+ memcpy(dir, fullname, m + 1);
dir[m + 1] = '\0';
}
/* base name */
@@ -385,7 +385,8 @@
while (--j) {
i++;
if (argv[i][0] != '-' && i < 3 && tmp[0] == '\0') {
- strncpy(tmp, argv[i],256);
+ memcpy(tmp, argv[i], sizeof(tmp));
+ tmp[sizeof(tmp) - 1] = '\0';
/* strip extension */
if (is_orc(tmp) || is_sco(tmp) || is_mid(tmp) || is_csd(tmp))
tmp[strlen(tmp) - 4] = '\0';
@@ -427,20 +428,24 @@
/* first, search environment variables, based on option list */
/* (the last option has the highest precedence) */
s = getenv("CSOUND");
- if (s != NULL) /* get default setting from CSOUND, if available */
- strncpy(tmp, s, 256);
+ if (s != NULL) { /* get default setting from CSOUND, if available */
+ memcpy(tmp, s, sizeof(tmp));
+ tmp[sizeof(tmp) - 1] = '\0';
+ }
for (i = (int) strlen(optlst); --i >= 0; ) {
sprintf(tmp2, "CSOUND_%c", optlst[i]);
s = getenv(tmp2);
if (s != NULL) {
- strncpy(tmp, s, 256);
+ memcpy(tmp, s, sizeof(tmp));
+ tmp[sizeof(tmp) - 1] = '\0';
if (tmp[0] != '\0') break;
}
}
/* if nothing was found, use default settings */
if (tmp[0] == '\0') {
- if (opts[17]) strncpy(tmp, default_csnd_r, 256);
- else strncpy(tmp, default_csnd, 256);
+ if (opts[17]) memcpy(tmp, default_csnd_r, sizeof(default_csnd_r));
+ else memcpy(tmp, default_csnd, sizeof(default_csnd));
+ tmp[sizeof(tmp) - 1] = '\0';
}
/* convert this to a list of quoted options */
s2 = cmdline;
--- util1/scot/scot.c.orig 2018-09-24 21:04:03.987585962 +0200
+++ util1/scot/scot.c 2018-09-24 21:04:47.448583372 +0200
@@ -684,7 +684,7 @@
ps = findparam(n, ptop);
if (strcmp(s, "."))
- strncpy(ps, s, 1+strlen(s));
+ memcpy(ps, s, 1+strlen(s));
}
static /* returns pointer to */