1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
Index: src/library/grDevices/src/devPS.c
===================================================================
--- src/library/grDevices/src/devPS.c (Revision 71663)
+++ src/library/grDevices/src/devPS.c (Revision 71664)
@@ -513,13 +513,15 @@
if (!(fp = R_fopen(R_ExpandFileName(buf), "r"))) return 0;
}
if (GetNextItem(fp, buf, -1, &state)) return 0; /* encoding name */
- strcpy(encname, buf+1);
+ strncpy(encname, buf+1, 99);
+ encname[99] = '\0';
if (!isPDF) snprintf(enccode, 5000, "/%s [\n", encname);
else enccode[0] = '\0';
if (GetNextItem(fp, buf, 0, &state)) { fclose(fp); return 0;} /* [ */
for(i = 0; i < 256; i++) {
if (GetNextItem(fp, buf, i, &state)) { fclose(fp); return 0; }
- strcpy(encnames[i].cname, buf+1);
+ strncpy(encnames[i].cname, buf+1, 39);
+ encnames[i].cname[39] = '\0';
strcat(enccode, " /"); strcat(enccode, encnames[i].cname);
if(i%8 == 7) strcat(enccode, "\n");
}
Index: src/library/grDevices/src/devPS.c
===================================================================
--- src/library/grDevices/src/devPS.c (Revision 71666)
+++ src/library/grDevices/src/devPS.c (Revision 71667)
@@ -521,7 +521,7 @@
for(i = 0; i < 256; i++) {
if (GetNextItem(fp, buf, i, &state)) { fclose(fp); return 0; }
strncpy(encnames[i].cname, buf+1, 39);
- encnames[i].cname[39] = '\0';
+ encnames[i].cname[39] = '\0';
strcat(enccode, " /"); strcat(enccode, encnames[i].cname);
if(i%8 == 7) strcat(enccode, "\n");
}
|