56 lines
1.9 KiB
Plaintext
56 lines
1.9 KiB
Plaintext
$OpenBSD: patch-src_main_Rdynload_c,v 1.2 2006/11/11 18:52:12 mbalmer Exp $
|
|
--- src/main/Rdynload.c.orig Thu Sep 14 04:05:06 2006
|
|
+++ src/main/Rdynload.c Tue Oct 3 18:12:02 2006
|
|
@@ -516,7 +516,8 @@ static DllInfo* AddDLL(char *path, int a
|
|
|
|
DeleteDLL(path);
|
|
if(CountDLL == MAX_NUM_DLLS) {
|
|
- strcpy(DLLerror, _("Maximal number of DLLs reached..."));
|
|
+ strlcpy(DLLerror, _("Maximal number of DLLs reached..."),
|
|
+ sizeof(DLLerror));
|
|
return NULL;
|
|
}
|
|
|
|
@@ -569,11 +570,12 @@ static DllInfo *R_RegisterDLL(HINSTANCE
|
|
|
|
dpath = malloc(strlen(path)+1);
|
|
if(dpath == NULL) {
|
|
- strcpy(DLLerror, _("could not allocate space for 'path'"));
|
|
+ strlcpy(DLLerror, _("could not allocate space for 'path'"),
|
|
+ sizeof(DLLerror));
|
|
R_osDynSymbol->closeLibrary(handle);
|
|
return 0;
|
|
}
|
|
- strcpy(dpath, path);
|
|
+ strlcpy(dpath, path, strlen(path) + 1);
|
|
|
|
if(R_osDynSymbol->fixPath)
|
|
R_osDynSymbol->fixPath(dpath);
|
|
@@ -581,7 +583,7 @@ static DllInfo *R_RegisterDLL(HINSTANCE
|
|
/* keep only basename from path */
|
|
p = Rf_strrchr(dpath, FILESEP[0]);
|
|
if(!p) p = dpath; else p++;
|
|
- if(strlen(p) < PATH_MAX) strcpy(DLLname, p);
|
|
+ if(strlen(p) < PATH_MAX) strlcpy(DLLname, p, sizeof(DLLname));
|
|
else error(_("DLLname '%s' is too long"), p);
|
|
|
|
/* remove SHLIB_EXT if present */
|
|
@@ -603,14 +605,15 @@ addDLL(char *dpath, char *DLLname, HINST
|
|
int ans = CountDLL;
|
|
char *name = malloc(strlen(DLLname)+1);
|
|
if(name == NULL) {
|
|
- strcpy(DLLerror, _("could not allocate space for 'name'"));
|
|
+ strlcpy(DLLerror, _("could not allocate space for 'name'"),
|
|
+ sizeof(DLLname));
|
|
if(handle)
|
|
R_osDynSymbol->closeLibrary(handle);
|
|
free(dpath);
|
|
return 0;
|
|
}
|
|
|
|
- strcpy(name, DLLname);
|
|
+ strlcpy(name, DLLname, strlen(DLLname) + 1);
|
|
LoadedDLL[CountDLL].path = dpath;
|
|
LoadedDLL[CountDLL].name = name;
|
|
LoadedDLL[CountDLL].handle = handle;
|