| 1 |
Fromscip-debian debian hplip 3.26.4+dfsg0-2 hplip/patches/`0069-Fixing-issues-found-by-coverity-scan.patch`#From.: Zdenek Dohnal <[email protected]scip-debian . . . identity/`[email protected]`.> |
| 2 |
Datescip-debian debian hplip 3.26.4+dfsg0-2 hplip/patches/`0069-Fixing-issues-found-by-coverity-scan.patch`#Date.: Fri, 31 Jan 2020 13:45:35 +0100 |
| 3 |
Subjectscip-debian debian hplip 3.26.4+dfsg0-2 hplip/patches/`0069-Fixing-issues-found-by-coverity-scan.patch`#Subject.: Fixing issues found by coverity scan |
| 4 |
|
| 5 |
Origin: https://src.fedoraproject.org/rpms/hplip/blob/master/f/hplip-covscan.patch |
| 6 |
--- |
| 7 |
Makefile.am | 6 +++--- |
| 8 |
common/utils.c | 6 +++++- |
| 9 |
io/hpmud/hpmud.c | 1 + |
| 10 |
io/hpmud/jd.c | 1 + |
| 11 |
io/hpmud/model.c | 2 ++ |
| 12 |
io/hpmud/musb.c | 2 +- |
| 13 |
io/hpmud/pp.c | 2 +- |
| 14 |
pcard/fat.c | 10 +++++++--- |
| 15 |
prnt/hpcups/genPCLm.cpp | 20 ++++++++++++++------ |
| 16 |
prnt/hpijs/context2.cpp | 1 + |
| 17 |
prnt/hpijs/systemservices.cpp | 3 +++ |
| 18 |
prnt/hpps/hppsfilter.c | 6 +++--- |
| 19 |
protocol/hp_ipp.h | 5 +++++ |
| 20 |
scan/sane/bb_ledm.c | 1 + |
| 21 |
scan/sane/common.h | 2 +- |
| 22 |
scan/sane/escl.c | 4 ++-- |
| 23 |
scan/sane/http.c | 1 + |
| 24 |
scan/sane/io.c | 6 +++--- |
| 25 |
scan/sane/ledm.c | 4 ++-- |
| 26 |
scan/sane/marvell.c | 22 +++++++++++----------- |
| 27 |
scan/sane/sclpml.c | 3 ++- |
| 28 |
scan/sane/soap.c | 20 ++++++++++---------- |
| 29 |
scan/sane/soapht.c | 20 ++++++++++---------- |
| 30 |
23 files changed, 90 insertions(+), 58 deletions(-) |
| 31 |
|
| 32 |
diff --git a/Makefile.amscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`Makefile.am`: b/Makefile.amscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`Makefile.am`: |
| 33 |
index ba63bbd..9cdfc36 100644 |
| 34 |
--- a/Makefile.am |
| 35 |
+++ b/Makefile.am |
| 36 |
@@ -3,7 +3,7 @@ |
| 37 |
# |
| 38 |
# (c) 2004-2015 Copyright HP Development Company, LP |
| 39 |
# Author: David Suffield, Naga Samrat Chowdary Narla, Sarbeswar Meher |
| 40 |
|
| 41 |
+INCLUDES = -Iip -Iio/hpmud -Iscan/sane -Iprnt/hpijs -Icommon/ -Iprotocol |
| 42 |
CFLAGS+= -DCONFDIR=\"$(hplip_confdir)\" |
| 43 |
CXXFLAGS+= -DCONFDIR=\"$(hplip_confdir)\" |
| 44 |
|
| 45 |
@@ -310,7 +310,7 @@ pcardextdir = $(PYTHONEXECDIR) |
| 46 |
pcardextdir = $(PYTHONEXECDIR) |
| 47 |
pcardext_LTLIBRARIES = pcardext.la |
| 48 |
pcardext_la_LDFLAGS = -module -avoid-version -lpython$(PYTHON_VERSION)m |
| 49 |
|
| 50 |
+pcardext_la_SOURCES = pcard/pcardext/pcardext.c pcard/fat.c pcard/pcardext/pcardext.h |
| 51 |
pcardext_la_CFLAGS = -I$(PYTHONINCLUDEDIR) |
| 52 |
|
| 53 |
# prnt |
| 54 |
@@ -322,7 +322,7 @@ lib_LTLIBRARIES += libhpipp.la |
| 55 |
#hpipp_LTLIBRARIES = hpipp.la |
| 56 |
#hpipp_la_LDFLAGS = -module -avoid-version |
| 57 |
libhpipp_la_SOURCES = protocol/hp_ipp.c protocol/hp_ipp.h protocol/hp_ipp_i.h |
| 58 |
|
| 59 |
+libhpipp_la_CFLAGS = -DCONFDIR=\"$(hplip_confdir)\" -D_GNU_SOURCE |
| 60 |
libhpipp_la_LDFLAGS = -version-info 0:1:0 |
| 61 |
libhpipp_la_LIBADD = -lcups libhpmud.la |
| 62 |
|
| 63 |
diff --git a/common/utils.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`common/utils.c`: b/common/utils.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`common/utils.c`: |
| 64 |
index 8e77bb4..8cdab0a 100644 |
| 65 |
--- a/common/utils.c |
| 66 |
+++ b/common/utils.c |
| 67 |
@@ -1,5 +1,9 @@ |
| 68 |
+#ifndef _GNU_SOURCE |
| 69 |
+#define _GNU_SOURCE |
| 70 |
+#endif |
| 71 |
+ |
| 72 |
#include "utils.h" |
| 73 |
|
| 74 |
+#include <string.h> |
| 75 |
#include <dlfcn.h> |
| 76 |
#include <sys/stat.h> |
| 77 |
#include <errno.h> |
| 78 |
diff --git a/io/hpmud/hpmud.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/hpmud.c`: b/io/hpmud/hpmud.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/hpmud.c`: |
| 79 |
index 7063487..7a9b92b 100644 |
| 80 |
--- a/io/hpmud/hpmud.c |
| 81 |
+++ b/io/hpmud/hpmud.c |
| 82 |
@@ -769,6 +769,7 @@ enum HPMUD_RESULT hpmud_get_dstat(HPMUD_DEVICE dd, struct hpmud_dstat *ds) |
| 83 |
} |
| 84 |
|
| 85 |
strncpy(ds->uri, msp->device[dd].uri, sizeof(ds->uri)); |
| 86 |
+ ds->uri[sizeof(ds->uri)-1] = '\0'; |
| 87 |
ds->io_mode = msp->device[dd].io_mode; |
| 88 |
ds->channel_cnt = msp->device[dd].channel_cnt; |
| 89 |
ds->mlc_up = msp->device[dd].mlc_up; |
| 90 |
diff --git a/io/hpmud/jd.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/jd.c`: b/io/hpmud/jd.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/jd.c`: |
| 91 |
index 94474c8..f86f96a 100644 |
| 92 |
--- a/io/hpmud/jd.c |
| 93 |
+++ b/io/hpmud/jd.c |
| 94 |
@@ -31,6 +31,7 @@ |
| 95 |
#endif |
| 96 |
|
| 97 |
#include <signal.h> |
| 98 |
+#include <stdlib.h> |
| 99 |
#include "hpmud.h" |
| 100 |
#include "hpmudi.h" |
| 101 |
|
| 102 |
diff --git a/io/hpmud/model.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/model.c`: b/io/hpmud/model.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/model.c`: |
| 103 |
index 4ea8990..a917d69 100644 |
| 104 |
--- a/io/hpmud/model.c |
| 105 |
+++ b/io/hpmud/model.c |
| 106 |
@@ -117,6 +117,7 @@ static int ReadConfig() |
| 107 |
if (rcbuf[0] == '[') |
| 108 |
{ |
| 109 |
strncpy(section, rcbuf, sizeof(section)); /* found new section */ |
| 110 |
+ section[sizeof(section)-1] = '\0'; |
| 111 |
continue; |
| 112 |
} |
| 113 |
|
| 114 |
@@ -125,6 +126,7 @@ static int ReadConfig() |
| 115 |
if ((strncasecmp(section, "[dirs]", 6) == 0) && (strcasecmp(key, "home") == 0)) |
| 116 |
{ |
| 117 |
strncpy(homedir, value, sizeof(homedir)); |
| 118 |
+ homedir[sizeof(homedir)-1] = '\0'; |
| 119 |
break; /* done */ |
| 120 |
} |
| 121 |
} |
| 122 |
diff --git a/io/hpmud/musb.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/musb.c`: b/io/hpmud/musb.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/musb.c`: |
| 123 |
index 57c212f..ea8be2b 100644 |
| 124 |
--- a/io/hpmud/musb.c |
| 125 |
+++ b/io/hpmud/musb.c |
| 126 |
@@ -777,7 +777,7 @@ static int device_id(int fd, unsigned char *buffer, int size) |
| 127 |
len = size-1; /* leave byte for zero termination */ |
| 128 |
if (len > 2) |
| 129 |
len -= 2; |
| 130 |
|
| 131 |
+ memmove(buffer, buffer+2, len); /* remove length */ |
| 132 |
buffer[len]=0; |
| 133 |
DBG("read actual device_id successfully fd=%d len=%d\n", fd, len); |
| 134 |
|
| 135 |
diff --git a/io/hpmud/pp.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/pp.c`: b/io/hpmud/pp.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`io/hpmud/pp.c`: |
| 136 |
index 74c5fdc..021d627 100644 |
| 137 |
--- a/io/hpmud/pp.c |
| 138 |
+++ b/io/hpmud/pp.c |
| 139 |
@@ -632,7 +632,7 @@ static int device_id(int fd, char *buffer, int size) |
| 140 |
len = size-1; /* leave byte for zero termination */ |
| 141 |
if (len > 2) |
| 142 |
len -= 2; |
| 143 |
|
| 144 |
+ memmove(buffer, buffer+2, len); /* remove length */ |
| 145 |
buffer[len]=0; |
| 146 |
|
| 147 |
DBG("read actual device_id successfully fd=%d len=%d\n", fd, len); |
| 148 |
diff --git a/pcard/fat.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`pcard/fat.c`: b/pcard/fat.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`pcard/fat.c`: |
| 149 |
index caa383f..e1425c0 100644 |
| 150 |
--- a/pcard/fat.c |
| 151 |
+++ b/pcard/fat.c |
| 152 |
@@ -519,14 +519,17 @@ int FatFreeSpace(void) |
| 153 |
|
| 154 |
int FatDiskAttributes( PHOTO_CARD_ATTRIBUTES * pa ) |
| 155 |
{ |
| 156 |
|
| 157 |
+ strncpy(pa->OEMID, bpb.OEMID, sizeof(pa->OEMID)); |
| 158 |
+ pa->OEMID[sizeof(pa->OEMID)-1] = '\0'; |
| 159 |
pa->BytesPerSector = bpb.BytesPerSector; |
| 160 |
pa->SectorsPerCluster = bpb.SectorsPerCluster; |
| 161 |
pa->ReservedSectors = bpb.ReservedSectors; |
| 162 |
pa->SectorsPerFat = bpb.SectorsPerFat; |
| 163 |
pa->RootEntries = bpb.RootEntries; |
| 164 |
|
| 165 |
|
| 166 |
+ strncpy(pa->SystemID, (char *)bpb.SystemID, sizeof(pa->SystemID)); |
| 167 |
+ pa->SystemID[sizeof(pa->SystemID)-1] = '\0'; |
| 168 |
+ strncpy(pa->VolumeLabel, (char *)bpb.VolumeLabel, sizeof(pa->VolumeLabel)); |
| 169 |
+ pa->VolumeLabel[sizeof(pa->VolumeLabel)-1] = '\0'; |
| 170 |
pa->WriteProtect = da.WriteProtect; |
| 171 |
|
| 172 |
return 0; |
| 173 |
@@ -741,6 +744,7 @@ int FatSetCWD(char *dir) |
| 174 |
return 1; |
| 175 |
|
| 176 |
strncpy(cwd.Name, fa.Name, sizeof(cwd.Name)); |
| 177 |
+ cwd.Name[sizeof(cwd.Name)-1] = '\0'; |
| 178 |
cwd.StartSector = ConvertClusterToSector(fa.StartCluster); |
| 179 |
cwd.CurrSector = cwd.StartSector; |
| 180 |
cwd.StartCluster = fa.StartCluster; |
| 181 |
diff --git a/prnt/hpcups/genPCLm.cppscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpcups/genPCLm.cpp`: b/prnt/hpcups/genPCLm.cppscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpcups/genPCLm.cpp`: |
| 182 |
index 0e1650c..f81b552 100644 |
| 183 |
--- a/prnt/hpcups/genPCLm.cpp |
| 184 |
+++ b/prnt/hpcups/genPCLm.cpp |
| 185 |
@@ -1242,11 +1242,16 @@ void PCLmGenerator::writeJobTicket() |
| 186 |
char orientation[256]; |
| 187 |
char duplex[256]; |
| 188 |
char colorthemes[256]; |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
+ strncpy(colorthemes,getColorThemesString(m_pPCLmSSettings->colorTheme), sizeof(colorthemes)); |
| 195 |
+ colorthemes[sizeof(colorthemes)-1] = '\0'; |
| 196 |
+ strncpy(inputBin,getInputBinString(m_pPCLmSSettings->userInputBin), sizeof(inputBin)); |
| 197 |
+ inputBin[sizeof(inputBin)-1] = '\0'; |
| 198 |
+ strncpy(outputBin,getOutputBin(m_pPCLmSSettings->userOutputBin), sizeof(outputBin)); |
| 199 |
+ outputBin[sizeof(outputBin)-1] = '\0'; |
| 200 |
+ strncpy(orientation,getOrientationString(m_pPCLmSSettings->userOrientation), sizeof(orientation)); |
| 201 |
+ orientation[sizeof(orientation)-1] = '\0'; |
| 202 |
+ strncpy(duplex,getDuplexString(currDuplexDisposition), sizeof(duplex)); |
| 203 |
+ duplex[sizeof(duplex)-1] = '\0'; |
| 204 |
|
| 205 |
snprintf(pOutStr,OUT_STR_SIZE,"%% genPCLm (Ver: %f)\n",PCLM_Ver); writeStr2OutBuff(pOutStr); |
| 206 |
snprintf(pOutStr,OUT_STR_SIZE,"%%============= Job Ticket =============\n"); writeStr2OutBuff(pOutStr); |
| 207 |
@@ -1640,7 +1645,10 @@ int PCLmGenerator::StartPage(PCLmPageSetup *PCLmPageContent, void **pOutBuffer, |
| 208 |
} |
| 209 |
|
| 210 |
if(strlen(PCLmPageContent->mediaSizeName)) |
| 211 |
|
| 212 |
+ { |
| 213 |
+ strncpy(currMediaName,PCLmPageContent->mediaSizeName, sizeof(currMediaName)); |
| 214 |
+ currMediaName[sizeof(currMediaName)-1] = '\0'; |
| 215 |
+ } |
| 216 |
|
| 217 |
currStripHeight=PCLmPageContent->stripHeight; |
| 218 |
if(!currStripHeight) |
| 219 |
diff --git a/prnt/hpijs/context2.cppscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpijs/context2.cpp`: b/prnt/hpijs/context2.cppscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpijs/context2.cpp`: |
| 220 |
index c3df482..19490b1 100644 |
| 221 |
--- a/prnt/hpijs/context2.cpp |
| 222 |
+++ b/prnt/hpijs/context2.cpp |
| 223 |
@@ -1302,6 +1302,7 @@ DRIVER_ERROR PrintContext::SelectDevice |
| 224 |
if(0 == strnlen((const char *)pSS->strDevID, DevIDBuffSize)) |
| 225 |
{ |
| 226 |
strncpy((char *)pSS->strDevID,szDeviceId,DevIDBuffSize); |
| 227 |
+ pSS->strDevID[sizeof(pSS->strDevID)-1] = '\0'; |
| 228 |
} |
| 229 |
thePrinter = pPFI->CreatePrinter (pSS, familyHandle); |
| 230 |
if (thePrinter->constructor_error != NO_ERROR) |
| 231 |
diff --git a/prnt/hpijs/systemservices.cppscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpijs/systemservices.cpp`: b/prnt/hpijs/systemservices.cppscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpijs/systemservices.cpp`: |
| 232 |
index 95f5a64..f5b4bb5 100644 |
| 233 |
--- a/prnt/hpijs/systemservices.cpp |
| 234 |
+++ b/prnt/hpijs/systemservices.cpp |
| 235 |
@@ -396,7 +396,10 @@ void SystemServices::AdjustIO(IO_MODE IM, const char* model) |
| 236 |
IOMode.bDevID =IM.bDevID && IOMode.bDevID; |
| 237 |
|
| 238 |
if (model) |
| 239 |
+ { |
| 240 |
strncpy(strModel,model, sizeof(strModel)); |
| 241 |
+ strModel[sizeof(strModel)-1] = '\0'; |
| 242 |
+ } |
| 243 |
} |
| 244 |
|
| 245 |
APDK_END_NAMESPACE |
| 246 |
diff --git a/prnt/hpps/hppsfilter.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpps/hppsfilter.c`: b/prnt/hpps/hppsfilter.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`prnt/hpps/hppsfilter.c`: |
| 247 |
index 5a2dc89..876135b 100644 |
| 248 |
--- a/prnt/hpps/hppsfilter.c |
| 249 |
+++ b/prnt/hpps/hppsfilter.c |
| 250 |
@@ -332,13 +332,13 @@ static void WriteHeader(char **argument) |
| 251 |
/* Writing Header Information |
| 252 |
argument[1] = JOB ID , argument[2]= USERNAME, argument[3] = TITLE */ |
| 253 |
hpwrite("\x1b%-12345X@PJL JOBNAME=", strlen("\x1b%-12345X@PJL JOBNAME=")); |
| 254 |
|
| 255 |
+ snprintf(buffer, MAX_BUFFER-1, "hplip_%s_%s\x0a", argument[2], argument[1]); |
| 256 |
hpwrite(buffer, strlen(buffer)); |
| 257 |
memset(buffer, 0, sizeof(buffer)); |
| 258 |
|
| 259 |
+ snprintf(buffer, MAX_BUFFER-1, "@PJL SET USERNAME=\"%s\"\x0a", argument[2]); |
| 260 |
hpwrite(buffer, strlen(buffer)); |
| 261 |
memset(buffer, 0, sizeof(buffer)); |
| 262 |
|
| 263 |
+ snprintf(buffer, MAX_BUFFER-1, "@PJL SET JOBNAME=\"%s\"\x0a", argument[3]); |
| 264 |
hpwrite(buffer, strlen(buffer)); |
| 265 |
fprintf(stderr, "HP PS filter func = WriteHeader : WRITING PJL HEADER INFO\n"); |
| 266 |
return; |
| 267 |
diff --git a/protocol/hp_ipp.hscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`protocol/hp_ipp.h`: b/protocol/hp_ipp.hscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`protocol/hp_ipp.h`: |
| 268 |
index 032be9a..b72f749 100644 |
| 269 |
--- a/protocol/hp_ipp.h |
| 270 |
+++ b/protocol/hp_ipp.h |
| 271 |
@@ -168,6 +168,11 @@ HPIPP_RESULT parseResponseHeader(char* header, int *content_length, int *chunked |
| 272 |
HPIPP_RESULT prepend_http_header(raw_ipp *raw_request,const char *resource); |
| 273 |
enum HPMUD_RESULT sendUSBRequest(char *buf, int size, raw_ipp *responseptr, char * device_uri); |
| 274 |
enum HPMUD_RESULT sendUSBFileRequest(char *buf, int size, int fileHandle,raw_ipp *responseptr, char *device_uri); |
| 275 |
+void _releaseCupsInstance(); |
| 276 |
+int addCupsPrinter(char *name, char *device_uri, char *location, char *ppd_file, char *model, char *info); |
| 277 |
+int delCupsPrinter(char *pr_name); |
| 278 |
+int setDefaultCupsPrinter(char *pr_name); |
| 279 |
+int controlCupsPrinter(char *pr_name, int op); |
| 280 |
|
| 281 |
ipp_t * createFaxDetailRequest(const char *printer_name); |
| 282 |
ipp_t * getDeviceFaxModemAttributes(char* device_uri,char* printer_name, int *count); |
| 283 |
diff --git a/scan/sane/bb_ledm.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/bb_ledm.c`: b/scan/sane/bb_ledm.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/bb_ledm.c`: |
| 284 |
index 168a6ab..4bdb304 100644 |
| 285 |
--- a/scan/sane/bb_ledm.c |
| 286 |
+++ b/scan/sane/bb_ledm.c |
| 287 |
@@ -26,6 +26,7 @@ |
| 288 |
# include "http.h" |
| 289 |
# include "xml.h" |
| 290 |
# include <stdlib.h> |
| 291 |
+# include <unistd.h> |
| 292 |
|
| 293 |
# include <stdint.h> |
| 294 |
|
| 295 |
diff --git a/scan/sane/common.hscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/common.h`: b/scan/sane/common.hscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/common.h`: |
| 296 |
index cdddd94..062d3a4 100644 |
| 297 |
--- a/scan/sane/common.h |
| 298 |
+++ b/scan/sane/common.h |
| 299 |
@@ -36,7 +36,7 @@ |
| 300 |
#define _STRINGIZE(x) #x |
| 301 |
#define STRINGIZE(x) _STRINGIZE(x) |
| 302 |
|
| 303 |
|
| 304 |
+#define BUG_SCAN(args...) {syslog(LOG_ERR, __FILE__ " " STRINGIZE(__LINE__) ": " args); DBG(2, __FILE__ " " STRINGIZE(__LINE__) ": " args);} |
| 305 |
#define BUG_DUMP(data, size) bugdump((data), (size)) |
| 306 |
#define BUG_SZ(args...) {syslog(LOG_ERR, args); DBG(2, args);} |
| 307 |
|
| 308 |
diff --git a/scan/sane/escl.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/escl.c`: b/scan/sane/escl.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/escl.c`: |
| 309 |
index 557b844..9fbbcaf 100644 |
| 310 |
--- a/scan/sane/escl.c |
| 311 |
+++ b/scan/sane/escl.c |
| 312 |
@@ -849,7 +849,7 @@ SANE_Status escl_control_option(SANE_Handle handle, SANE_Int option, SANE_Action |
| 313 |
//DBG8("escl_control_option (option=%s) action=%d\n", ps->option[option].name, action); |
| 314 |
if (stat != SANE_STATUS_GOOD) |
| 315 |
{ |
| 316 |
|
| 317 |
+ BUG_SCAN("control_option failed: option=%s action=%s\n", ps->option[option].name, action==SANE_ACTION_GET_VALUE ? "get" : action==SANE_ACTION_SET_VALUE ? "set" : "auto"); |
| 318 |
} |
| 319 |
|
| 320 |
return stat; |
| 321 |
@@ -1159,7 +1159,7 @@ void escl_close(SANE_Handle handle) |
| 322 |
|
| 323 |
if (ps == NULL || ps != session) |
| 324 |
{ |
| 325 |
|
| 326 |
+ BUG_SCAN("invalid sane_close\n"); |
| 327 |
return; |
| 328 |
} |
| 329 |
|
| 330 |
diff --git a/scan/sane/http.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/http.c`: b/scan/sane/http.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/http.c`: |
| 331 |
index 5dc10e3..9a9610d 100644 |
| 332 |
--- a/scan/sane/http.c |
| 333 |
+++ b/scan/sane/http.c |
| 334 |
@@ -36,6 +36,7 @@ |
| 335 |
#include <string.h> |
| 336 |
#include <syslog.h> |
| 337 |
#include <ctype.h> |
| 338 |
+#include <unistd.h> |
| 339 |
#include "hpmud.h" |
| 340 |
#include "http.h" |
| 341 |
|
| 342 |
diff --git a/scan/sane/io.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/io.c`: b/scan/sane/io.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/io.c`: |
| 343 |
index 4508458..dbbb296 100755 |
| 344 |
--- a/scan/sane/io.c |
| 345 |
+++ b/scan/sane/io.c |
| 346 |
@@ -50,7 +50,7 @@ int __attribute__ ((visibility ("hidden"))) InitDbus(void) |
| 347 |
|
| 348 |
if (dbus_error_is_set(&dbus_err)) |
| 349 |
{ |
| 350 |
|
| 351 |
+ BUG_SCAN("dBus Connection Error (%s)!\n", dbus_err.message); |
| 352 |
dbus_error_free(&dbus_err); |
| 353 |
} |
| 354 |
|
| 355 |
@@ -79,7 +79,7 @@ int __attribute__ ((visibility ("hidden"))) SendScanEvent(char *device_uri, int |
| 356 |
|
| 357 |
if (NULL == msg) |
| 358 |
{ |
| 359 |
|
| 360 |
+ BUG_SCAN("dbus message is NULL!\n"); |
| 361 |
return 0; |
| 362 |
} |
| 363 |
|
| 364 |
@@ -94,7 +94,7 @@ int __attribute__ ((visibility ("hidden"))) SendScanEvent(char *device_uri, int |
| 365 |
|
| 366 |
if (!dbus_connection_send(dbus_conn, msg, NULL)) |
| 367 |
{ |
| 368 |
|
| 369 |
+ BUG_SCAN("dbus message send failed!\n"); |
| 370 |
return 0; |
| 371 |
} |
| 372 |
|
| 373 |
diff --git a/scan/sane/ledm.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/ledm.c`: b/scan/sane/ledm.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/ledm.c`: |
| 374 |
index a56f534..a594008 100644 |
| 375 |
--- a/scan/sane/ledm.c |
| 376 |
+++ b/scan/sane/ledm.c |
| 377 |
@@ -813,7 +813,7 @@ SANE_Status ledm_control_option(SANE_Handle handle, SANE_Int option, SANE_Action |
| 378 |
|
| 379 |
if (stat != SANE_STATUS_GOOD) |
| 380 |
{ |
| 381 |
|
| 382 |
+ BUG_SCAN("control_option failed: option=%s action=%s\n", ps->option[option].name, action==SANE_ACTION_GET_VALUE ? "get" : action==SANE_ACTION_SET_VALUE ? "set" : "auto"); |
| 383 |
} |
| 384 |
|
| 385 |
return stat; |
| 386 |
@@ -1080,7 +1080,7 @@ void ledm_close(SANE_Handle handle) |
| 387 |
|
| 388 |
if (ps == NULL || ps != session) |
| 389 |
{ |
| 390 |
|
| 391 |
+ BUG_SCAN("invalid sane_close\n"); |
| 392 |
return; |
| 393 |
} |
| 394 |
|
| 395 |
diff --git a/scan/sane/marvell.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/marvell.c`: b/scan/sane/marvell.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/marvell.c`: |
| 396 |
index 6cac67a..fce2458 100644 |
| 397 |
--- a/scan/sane/marvell.c |
| 398 |
+++ b/scan/sane/marvell.c |
| 399 |
@@ -134,7 +134,7 @@ static int get_ip_data(struct marvell_session *ps, SANE_Byte *data, SANE_Int max |
| 400 |
|
| 401 |
if (!ps->ip_handle) |
| 402 |
{ |
| 403 |
|
| 404 |
+ BUG_SCAN("invalid ipconvert state\n"); |
| 405 |
goto bugout; |
| 406 |
} |
| 407 |
|
| 408 |
@@ -335,7 +335,7 @@ static struct marvell_session *create_session() |
| 409 |
|
| 410 |
if ((ps = malloc(sizeof(struct marvell_session))) == NULL) |
| 411 |
{ |
| 412 |
|
| 413 |
+ BUG_SCAN("malloc failed: %m\n"); |
| 414 |
return NULL; |
| 415 |
} |
| 416 |
memset(ps, 0, sizeof(struct marvell_session)); |
| 417 |
@@ -402,7 +402,7 @@ SANE_Status marvell_open(SANE_String_Const device, SANE_Handle *handle) |
| 418 |
|
| 419 |
if (session) |
| 420 |
{ |
| 421 |
|
| 422 |
+ BUG_SCAN("session in use\n"); |
| 423 |
return SANE_STATUS_DEVICE_BUSY; |
| 424 |
} |
| 425 |
|
| 426 |
@@ -431,7 +431,7 @@ SANE_Status marvell_open(SANE_String_Const device, SANE_Handle *handle) |
| 427 |
|
| 428 |
if (hpmud_open_device(session->uri, ma.mfp_mode, &session->dd) != HPMUD_R_OK) |
| 429 |
{ |
| 430 |
|
| 431 |
+ BUG_SCAN("unable to open device %s\n", session->uri); |
| 432 |
goto bugout; |
| 433 |
|
| 434 |
free(session); |
| 435 |
@@ -441,7 +441,7 @@ SANE_Status marvell_open(SANE_String_Const device, SANE_Handle *handle) |
| 436 |
|
| 437 |
if (hpmud_open_channel(session->dd, HPMUD_S_MARVELL_SCAN_CHANNEL, &session->cd) != HPMUD_R_OK) |
| 438 |
{ |
| 439 |
|
| 440 |
+ BUG_SCAN("unable to open %s channel %s\n", HPMUD_S_MARVELL_SCAN_CHANNEL, session->uri); |
| 441 |
stat = SANE_STATUS_DEVICE_BUSY; |
| 442 |
goto bugout; |
| 443 |
} |
| 444 |
@@ -554,7 +554,7 @@ void marvell_close(SANE_Handle handle) |
| 445 |
|
| 446 |
if (ps == NULL || ps != session) |
| 447 |
{ |
| 448 |
|
| 449 |
+ BUG_SCAN("invalid sane_close\n"); |
| 450 |
return; |
| 451 |
} |
| 452 |
|
| 453 |
@@ -849,7 +849,7 @@ SANE_Status marvell_control_option(SANE_Handle handle, SANE_Int option, SANE_Act |
| 454 |
stat = SANE_STATUS_GOOD; |
| 455 |
break; |
| 456 |
} |
| 457 |
|
| 458 |
+ BUG_SCAN("value=%d brymin=%d brymax=%d\n", *int_value, ps->bryRange.min, ps->bryRange.max); |
| 459 |
} |
| 460 |
else |
| 461 |
{ /* Set default. */ |
| 462 |
@@ -866,7 +866,7 @@ SANE_Status marvell_control_option(SANE_Handle handle, SANE_Int option, SANE_Act |
| 463 |
|
| 464 |
if (stat != SANE_STATUS_GOOD) |
| 465 |
{ |
| 466 |
|
| 467 |
+ BUG_SCAN("control_option failed: option=%s action=%s\n", ps->option[option].name, |
| 468 |
action==SANE_ACTION_GET_VALUE ? "get" : action==SANE_ACTION_SET_VALUE ? "set" : "auto"); |
| 469 |
} |
| 470 |
|
| 471 |
@@ -905,7 +905,7 @@ SANE_Status marvell_start(SANE_Handle handle) |
| 472 |
|
| 473 |
if (set_extents(ps)) |
| 474 |
{ |
| 475 |
|
| 476 |
+ BUG_SCAN("invalid extents: tlx=%d brx=%d tly=%d bry=%d minwidth=%d minheight%d maxwidth=%d maxheight=%d\n", |
| 477 |
ps->currentTlx, ps->currentTly, ps->currentBrx, ps->currentBry, ps->min_width, ps->min_height, ps->tlxRange.max, ps->tlyRange.max); |
| 478 |
stat = SANE_STATUS_INVAL; |
| 479 |
goto bugout; |
| 480 |
@@ -963,7 +963,7 @@ SANE_Status marvell_start(SANE_Handle handle) |
| 481 |
/* Open image processor. */ |
| 482 |
if ((ret = ipOpen(pXform-xforms, xforms, 0, &ps->ip_handle)) != IP_DONE) |
| 483 |
{ |
| 484 |
|
| 485 |
+ BUG_SCAN("unable open image processor: err=%d\n", ret); |
| 486 |
stat = SANE_STATUS_INVAL; |
| 487 |
goto bugout; |
| 488 |
} |
| 489 |
@@ -1023,7 +1023,7 @@ SANE_Status marvell_read(SANE_Handle handle, SANE_Byte *data, SANE_Int maxLength |
| 490 |
|
| 491 |
if(ret & (IP_INPUT_ERROR | IP_FATAL_ERROR)) |
| 492 |
{ |
| 493 |
|
| 494 |
+ BUG_SCAN("ipConvert error=%x\n", ret); |
| 495 |
goto bugout; |
| 496 |
} |
| 497 |
|
| 498 |
diff --git a/scan/sane/sclpml.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/sclpml.c`: b/scan/sane/sclpml.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/sclpml.c`: |
| 499 |
index 61500da..dfeedb9 100644 |
| 500 |
--- a/scan/sane/sclpml.c |
| 501 |
+++ b/scan/sane/sclpml.c |
| 502 |
@@ -30,6 +30,7 @@ |
| 503 |
#include <unistd.h> |
| 504 |
#include <fcntl.h> |
| 505 |
#include <string.h> |
| 506 |
+#include <sys/time.h> |
| 507 |
#include "sane.h" |
| 508 |
#include "saneopts.h" |
| 509 |
#include "common.h" |
| 510 |
@@ -2087,7 +2088,7 @@ void sclpml_close(SANE_Handle handle) |
| 511 |
DBG(8, "sane_hpaio_close(): %s %d\n", __FILE__, __LINE__); |
| 512 |
if (hpaio == NULL || hpaio != session) |
| 513 |
{ |
| 514 |
|
| 515 |
+ BUG_SCAN("invalid sane_close\n"); |
| 516 |
return; |
| 517 |
} |
| 518 |
|
| 519 |
diff --git a/scan/sane/soap.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/soap.c`: b/scan/sane/soap.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/soap.c`: |
| 520 |
index a45f1a0..e59fb46 100644 |
| 521 |
--- a/scan/sane/soap.c |
| 522 |
+++ b/scan/sane/soap.c |
| 523 |
@@ -142,7 +142,7 @@ static int get_ip_data(struct soap_session *ps, SANE_Byte *data, SANE_Int maxLen |
| 524 |
|
| 525 |
if (!ps->ip_handle) |
| 526 |
{ |
| 527 |
|
| 528 |
+ BUG_SCAN("invalid ipconvert state\n"); |
| 529 |
goto bugout; |
| 530 |
} |
| 531 |
|
| 532 |
@@ -219,7 +219,7 @@ static struct soap_session *create_session() |
| 533 |
|
| 534 |
if ((ps = malloc(sizeof(struct soap_session))) == NULL) |
| 535 |
{ |
| 536 |
|
| 537 |
+ BUG_SCAN("malloc failed: %m\n"); |
| 538 |
return NULL; |
| 539 |
} |
| 540 |
memset(ps, 0, sizeof(struct soap_session)); |
| 541 |
@@ -418,7 +418,7 @@ SANE_Status soap_open(SANE_String_Const device, SANE_Handle *handle) |
| 542 |
|
| 543 |
if (session) |
| 544 |
{ |
| 545 |
|
| 546 |
+ BUG_SCAN("session in use\n"); |
| 547 |
return SANE_STATUS_DEVICE_BUSY; |
| 548 |
} |
| 549 |
|
| 550 |
@@ -434,7 +434,7 @@ SANE_Status soap_open(SANE_String_Const device, SANE_Handle *handle) |
| 551 |
|
| 552 |
if (hpmud_open_device(session->uri, ma.mfp_mode, &session->dd) != HPMUD_R_OK) |
| 553 |
{ |
| 554 |
|
| 555 |
+ BUG_SCAN("unable to open device %s\n", session->uri); |
| 556 |
goto bugout; |
| 557 |
|
| 558 |
free(session); |
| 559 |
@@ -519,7 +519,7 @@ void soap_close(SANE_Handle handle) |
| 560 |
|
| 561 |
if (ps == NULL || ps != session) |
| 562 |
{ |
| 563 |
|
| 564 |
+ BUG_SCAN("invalid sane_close\n"); |
| 565 |
return; |
| 566 |
} |
| 567 |
|
| 568 |
@@ -824,7 +824,7 @@ SANE_Status soap_control_option(SANE_Handle handle, SANE_Int option, SANE_Action |
| 569 |
|
| 570 |
if (stat != SANE_STATUS_GOOD) |
| 571 |
{ |
| 572 |
|
| 573 |
+ BUG_SCAN("control_option failed: option=%s action=%s\n", ps->option[option].name, |
| 574 |
action==SANE_ACTION_GET_VALUE ? "get" : action==SANE_ACTION_SET_VALUE ? "set" : "auto"); |
| 575 |
} |
| 576 |
|
| 577 |
@@ -862,7 +862,7 @@ SANE_Status soap_start(SANE_Handle handle) |
| 578 |
ps->user_cancel = 0; |
| 579 |
if (set_extents(ps)) |
| 580 |
{ |
| 581 |
|
| 582 |
+ BUG_SCAN("invalid extents: tlx=%d brx=%d tly=%d bry=%d minwidth=%d minheight%d maxwidth=%d maxheight=%d\n", |
| 583 |
ps->currentTlx, ps->currentTly, ps->currentBrx, ps->currentBry, ps->min_width, ps->min_height, ps->tlxRange.max, ps->tlyRange.max); |
| 584 |
stat = SANE_STATUS_INVAL; |
| 585 |
goto bugout; |
| 586 |
@@ -913,7 +913,7 @@ SANE_Status soap_start(SANE_Handle handle) |
| 587 |
/* Open image processor. */ |
| 588 |
if ((ret = ipOpen(pXform-xforms, xforms, 0, &ps->ip_handle)) != IP_DONE) |
| 589 |
{ |
| 590 |
|
| 591 |
+ BUG_SCAN("unable open image processor: err=%d\n", ret); |
| 592 |
stat = SANE_STATUS_INVAL; |
| 593 |
goto bugout; |
| 594 |
} |
| 595 |
@@ -955,7 +955,7 @@ SANE_Status soap_start(SANE_Handle handle) |
| 596 |
|
| 597 |
if (ret & (IP_INPUT_ERROR | IP_FATAL_ERROR | IP_DONE)) |
| 598 |
{ |
| 599 |
|
| 600 |
+ BUG_SCAN("ipConvert error=%x\n", ret); |
| 601 |
stat = SANE_STATUS_IO_ERROR; |
| 602 |
goto bugout; |
| 603 |
} |
| 604 |
@@ -1007,7 +1007,7 @@ SANE_Status soap_read(SANE_Handle handle, SANE_Byte *data, SANE_Int maxLength, S |
| 605 |
|
| 606 |
if(ret & (IP_INPUT_ERROR | IP_FATAL_ERROR)) |
| 607 |
{ |
| 608 |
|
| 609 |
+ BUG_SCAN("ipConvert error=%x\n", ret); |
| 610 |
goto bugout; |
| 611 |
} |
| 612 |
|
| 613 |
diff --git a/scan/sane/soapht.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/soapht.c`: b/scan/sane/soapht.cscip-debian debian hplip 3.26.4+dfsg0-2 hplip/upstream/`scan/sane/soapht.c`: |
| 614 |
index df0e807..c8de979 100644 |
| 615 |
--- a/scan/sane/soapht.c |
| 616 |
+++ b/scan/sane/soapht.c |
| 617 |
@@ -136,7 +136,7 @@ static int get_ip_data(struct soap_session *ps, SANE_Byte *data, SANE_Int maxLen |
| 618 |
|
| 619 |
if (!ps->ip_handle) |
| 620 |
{ |
| 621 |
|
| 622 |
+ BUG_SCAN("invalid ipconvert state\n"); |
| 623 |
goto bugout; |
| 624 |
} |
| 625 |
|
| 626 |
@@ -435,7 +435,7 @@ static struct soap_session *create_session() |
| 627 |
|
| 628 |
if ((ps = malloc(sizeof(struct soap_session))) == NULL) |
| 629 |
{ |
| 630 |
|
| 631 |
+ BUG_SCAN("malloc failed: %m\n"); |
| 632 |
return NULL; |
| 633 |
} |
| 634 |
memset(ps, 0, sizeof(struct soap_session)); |
| 635 |
@@ -459,7 +459,7 @@ SANE_Status soapht_open(SANE_String_Const device, SANE_Handle *handle) |
| 636 |
|
| 637 |
if (session) |
| 638 |
{ |
| 639 |
|
| 640 |
+ BUG_SCAN("session in use\n"); |
| 641 |
return SANE_STATUS_DEVICE_BUSY; |
| 642 |
} |
| 643 |
|
| 644 |
@@ -475,7 +475,7 @@ SANE_Status soapht_open(SANE_String_Const device, SANE_Handle *handle) |
| 645 |
|
| 646 |
if (hpmud_open_device(session->uri, ma.mfp_mode, &session->dd) != HPMUD_R_OK) |
| 647 |
{ |
| 648 |
|
| 649 |
+ BUG_SCAN("unable to open device %s\n", session->uri); |
| 650 |
goto bugout; |
| 651 |
|
| 652 |
free(session); |
| 653 |
@@ -554,7 +554,7 @@ void soapht_close(SANE_Handle handle) |
| 654 |
|
| 655 |
if (ps == NULL || ps != session) |
| 656 |
{ |
| 657 |
|
| 658 |
+ BUG_SCAN("invalid sane_close\n"); |
| 659 |
return; |
| 660 |
} |
| 661 |
|
| 662 |
@@ -904,7 +904,7 @@ SANE_Status soapht_control_option(SANE_Handle handle, SANE_Int option, SANE_Acti |
| 663 |
|
| 664 |
if (stat != SANE_STATUS_GOOD) |
| 665 |
{ |
| 666 |
|
| 667 |
+ BUG_SCAN("control_option failed: option=%s action=%s\n", ps->option[option].name, |
| 668 |
action==SANE_ACTION_GET_VALUE ? "get" : action==SANE_ACTION_SET_VALUE ? "set" : "auto"); |
| 669 |
} |
| 670 |
|
| 671 |
@@ -946,7 +946,7 @@ SANE_Status soapht_start(SANE_Handle handle) |
| 672 |
|
| 673 |
if (set_extents(ps)) |
| 674 |
{ |
| 675 |
|
| 676 |
+ BUG_SCAN("invalid extents: tlx=%d brx=%d tly=%d bry=%d minwidth=%d minheight%d maxwidth=%d maxheight=%d\n", |
| 677 |
ps->currentTlx, ps->currentTly, ps->currentBrx, ps->currentBry, ps->min_width, ps->min_height, ps->tlxRange.max, ps->tlyRange.max); |
| 678 |
stat = SANE_STATUS_INVAL; |
| 679 |
goto bugout; |
| 680 |
@@ -1032,7 +1032,7 @@ SANE_Status soapht_start(SANE_Handle handle) |
| 681 |
/* Open image processor. */ |
| 682 |
if ((ret = ipOpen(pXform-xforms, xforms, 0, &ps->ip_handle)) != IP_DONE) |
| 683 |
{ |
| 684 |
|
| 685 |
+ BUG_SCAN("unable open image processor: err=%d\n", ret); |
| 686 |
stat = SANE_STATUS_INVAL; |
| 687 |
goto bugout; |
| 688 |
} |
| 689 |
@@ -1075,7 +1075,7 @@ SANE_Status soapht_start(SANE_Handle handle) |
| 690 |
|
| 691 |
if (ret & (IP_INPUT_ERROR | IP_FATAL_ERROR | IP_DONE)) |
| 692 |
{ |
| 693 |
|
| 694 |
+ BUG_SCAN("ipConvert error=%x\n", ret); |
| 695 |
stat = SANE_STATUS_IO_ERROR; |
| 696 |
goto bugout; |
| 697 |
} |
| 698 |
@@ -1124,7 +1124,7 @@ SANE_Status soapht_read(SANE_Handle handle, SANE_Byte *data, SANE_Int maxLength, |
| 699 |
|
| 700 |
if(ret & (IP_INPUT_ERROR | IP_FATAL_ERROR)) |
| 701 |
{ |
| 702 |
|
| 703 |
+ BUG_SCAN("ipConvert error=%x\n", ret); |
| 704 |
goto bugout; |
| 705 |
} |
| 706 |
|