--- libppd-0.10.orig/src/ppd.c
+++ libppd-0.10/src/ppd.c
@@ -425,10 +425,6 @@
char **filter; // Pointer to filter
PpdEmulator *emul; // Pointer to emulator class
GSList *list; // Generic list enumerator
- char copt1[41], // These temporarily hold
- copt2[41], // data that will be put in
- cchoice1[41], // a PpdConstraint
- cchoice2[41]; //
// cups_lang_t *language; // Default language
// Get the default language for the user...
@@ -740,7 +736,7 @@
} else if (strcmp(keyword, "OpenUI") == 0) {
/* Add an option record to the current sub-group, group, or file... */
if (name[0] == '*')
- strcpy(name, name + 1);
+ memmove(name, name + 1, strlen(name));
if (string == NULL)
goto failout1;
@@ -807,7 +803,7 @@
// Add an option record to the current JCLs...
if (name[0] == '*')
- strcpy(name, name + 1);
+ memmove(name, name + 1, strlen(name));
if ((option = ppd_get_option(group, name)) == NULL)
option = ppd_option_new(group, keyword);
@@ -828,11 +824,12 @@
|| strcmp(keyword, "JCLCloseUI") == 0)
option = NULL;
else if (strcmp(keyword, "OpenGroup") == 0) {
+ char *h;
// Open a new group...
if (group != NULL)
goto failout;
- if (strchr(string, '/') != NULL) // Just show human readable text
- strcpy(string, strchr(string, '/') + 1);
+ if ((h = strchr(string, '/')) != NULL) // Just show human readable text
+ memmove(string, h+1, strlen(h));
ppd_decode(string);
ppd_fix(string);
@@ -858,7 +855,7 @@
if (sscanf(string, "%f%40s%40s", &order, name, keyword) != 3)
goto failout;
if (keyword[0] == '*')
- strcpy(keyword, keyword + 1);
+ memmove(keyword, keyword + 1, strlen(keyword));
if (strcmp(name, "ExitServer") == 0)
section = PPD_ORDER_EXIT;
@@ -992,7 +989,12 @@
ppd->consts = g_slist_append(ppd->consts, constraint);
- m = sscanf(string, "%40s%40s%40s%40s", copt1, cchoice1, copt2, cchoice2);
+ {char copt1[81], // These temporarily hold
+ copt2[81], // data that will be put in
+ cchoice1[81], // a PpdConstraint
+ cchoice2[81]; //
+
+ m = sscanf(string, "%80s%80s%80s%80s", copt1, cchoice1, copt2, cchoice2);
switch (m) {
case 0: // Error
@@ -1003,50 +1005,49 @@
break;
case 2: // Two options...
if (copt1[0] == '*')
- strcpy(copt1, copt1 + 1);
+ constraint->option1 = g_string_new(copt1 + 1);
+ else
+ constraint->option1 = g_string_new(copt1);
if (cchoice1[0] == '*')
- strcpy(copt2, cchoice1 + 1);
+ constraint->option2 = g_string_new(cchoice1 + 1);
else
- strcpy(copt2, cchoice1);
+ constraint->option2 = g_string_new(cchoice1);
- constraint->option1 = g_string_new(copt1);
- constraint->option2 = g_string_new(copt2);
break;
case 3: // Two options, one choice...
if (copt1[0] == '*')
- strcpy(copt1, copt1 + 1);
- constraint->option1 = g_string_new(copt1);
+ constraint->option1 = g_string_new(copt1 + 1);
+ else
+ constraint->option1 = g_string_new(copt1);
if (cchoice1[0] == '*') {
- strcpy(cchoice2, copt2);
- strcpy(copt2, cchoice1 + 1);
- cchoice1[0] = '\0';
-
- constraint->choice2 = g_string_new(cchoice2);
- constraint->option2 = g_string_new(copt2);
+ constraint->choice2 = g_string_new(copt2);
+ constraint->option2 = g_string_new(cchoice1 + 1);
} else {
if (copt2[0] == '*')
- strcpy(copt2, copt2 + 1);
-
- constraint->option2 = g_string_new(copt2);
- cchoice2[0] = '\0';
+ constraint->option2 = g_string_new(copt2 + 1);
+ else
+ constraint->option2 = g_string_new(copt2);
}
break;
case 4: // Two options, two choices...
if (copt1[0] == '*')
- strcpy(copt1, copt1 + 1);
+ constraint->option1 = g_string_new(copt1 + 1);
+ else
+ constraint->option1 = g_string_new(copt1);
if (copt2[0] == '*')
- strcpy(copt2, copt2 + 1);
+ constraint->option2 = g_string_new(copt2 + 1);
+ else
+ constraint->option2 = g_string_new(copt2);
- constraint->option1 = g_string_new(copt1);
- constraint->option2 = g_string_new(copt2);
constraint->choice1 = g_string_new(cchoice1);
constraint->choice2 = g_string_new(cchoice2);
break;
}
+ }/* closes block where we mess up with cchoice1 cchoice2 copt1 copt2 */
} else if (strcmp(keyword, "PaperDimension") == 0) {
if ((size = ppd_get_page_size(ppd, name)) != NULL)
sscanf(string, "%f%f", &(size->width), &(size->length));