From 61d7a0bd9dbdcec73b7c042b0273a82d21fe163e Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Tue, 25 Aug 2020 11:34:55 +0200 Subject: [PATCH] 1772698 - dont use uninitialized value as an index --- hplip-model-mismatch.patch | 10 ++++------ hplip.spec | 5 ++++- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/hplip-model-mismatch.patch b/hplip-model-mismatch.patch index 594f205..1dbe3c0 100644 --- a/hplip-model-mismatch.patch +++ b/hplip-model-mismatch.patch @@ -26,7 +26,7 @@ index 20df27a..7ed4918 100644 { stat = HPMUD_R_INVALID_URI; /* different device plugged in */ diff --git a/io/hpmud/model.c b/io/hpmud/model.c -index d546ec1..d1809a9 100644 +index d546ec1..adb3d87 100644 --- a/io/hpmud/model.c +++ b/io/hpmud/model.c @@ -407,7 +407,10 @@ static int ParseFile(char *datFile, char *model, char *attr, int attrSize, int * @@ -41,13 +41,11 @@ index d546ec1..d1809a9 100644 if ((fp = fopen(datFile, "r")) == NULL) goto bugout; -@@ -420,12 +423,18 @@ static int ParseFile(char *datFile, char *model, char *attr, int attrSize, int * - if (rcbuf[0] == '[') - { +@@ -422,10 +425,17 @@ static int ParseFile(char *datFile, char *model, char *attr, int attrSize, int * strncpy(section, rcbuf+1, sizeof(section)); /* found new section */ -- n = strlen(section); + n = strlen(section); section[n-2]=0; /* remove ']' and CR */ -+ n = strlen(section); ++ n -= 2; if (strcasecmp(model, section) == 0 || - (section[0] == 'h' && section[1] == 'p' && - section[2] == '_' && diff --git a/hplip.spec b/hplip.spec index 62b8a3c..b0ce568 100644 --- a/hplip.spec +++ b/hplip.spec @@ -7,7 +7,7 @@ Summary: HP Linux Imaging and Printing Project Name: hplip Version: 3.20.6 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2+ and MIT and BSD and IJG and Public Domain and GPLv2+ with exceptions and ISC Url: https://developers.hp.com/hp-linux-imaging-and-printing @@ -738,6 +738,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop %config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio %changelog +* Tue Aug 25 2020 Zdenek Dohnal - 3.20.6-9 +- 1772698 - dont use uninitialized value as an index + * Mon Aug 24 2020 Zdenek Dohnal - 3.20.6-8 - typo in hplip-model-mismatch.patch causes regression for 1772698