cups-filters/cups-filters-uninit-attrs.patch
DistroBaker efcac2932d Merged update from upstream sources
This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/cups-filters.git#12bd6655362f7e0f8790c34a208d10ca6333f99e
2020-11-24 06:11:48 +00:00

38 lines
1.8 KiB
Diff

diff --git a/utils/cups-browsed.c b/utils/cups-browsed.c
index 826679f..93f21c3 100644
--- a/utils/cups-browsed.c
+++ b/utils/cups-browsed.c
@@ -1415,8 +1415,8 @@ void add_mimetype_attributes(char* cluster_name, ipp_t **merged_attributes)
for (q = (char *)cupsArrayFirst(list),i=0;
q;
q = (char *)cupsArrayNext(list),i++) {
- values[i]=malloc(sizeof(char)*strlen(q)+1);
- strncpy(values[i], q, sizeof(values[i]) - 1);
+ values[i]=malloc(sizeof(char) * (strlen(q) + 1));
+ snprintf(values[i], strlen(q) + 1, "%s", q);
}
ippAddStrings(*merged_attributes, IPP_TAG_PRINTER,IPP_TAG_MIMETYPE,
attributes[attr_no], num_value, NULL,
@@ -1487,8 +1487,8 @@ void add_tagzero_attributes(char* cluster_name, ipp_t **merged_attributes)
/* Transferring attributes value from cups Array to char* array*/
for (q = (char *)cupsArrayFirst(list), i = 0; q;
q = (char *)cupsArrayNext(list), i ++) {
- values[i] = malloc(sizeof(char) * strlen(q) + 1);
- strncpy(values[i], q, sizeof(values[i]) - 1);
+ values[i] = malloc(sizeof(char) * (strlen(q) + 1));
+ snprintf(values[i], strlen(q) + 1, "%s", q);
}
ippAddStrings(*merged_attributes, IPP_TAG_PRINTER,
IPP_TAG_KEYWORD, attributes[attr_no],
@@ -1558,8 +1558,8 @@ void add_keyword_attributes(char* cluster_name, ipp_t **merged_attributes)
for (q = (char *)cupsArrayFirst(list), i=0;
q;
q = (char *)cupsArrayNext(list), i ++) {
- values[i] = malloc(sizeof(char) * strlen(q) + 1);
- strncpy(values[i], q, sizeof(values[i]) - 1);
+ values[i] = malloc(sizeof(char) * (strlen(q) + 1));
+ snprintf(values[i], strlen(q) + 1, "%s", q);
}
ippAddStrings(*merged_attributes, IPP_TAG_PRINTER, IPP_TAG_KEYWORD,
attributes[attr_no], num_value, NULL,