From 5889eb7c47a3c0bd6b15fc7a35989d70789e9dba Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Fri, 3 Jul 2015 14:27:31 -0400 Subject: [PATCH] PDF Printer: Check FlattenedSize() result for error CID 610903 --- src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp b/src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp index 2aa07988c2..96581954ab 100644 --- a/src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp +++ b/src/add-ons/print/drivers/pdf/source/PrinterSettings.cpp @@ -115,11 +115,13 @@ PrinterSettings::ReadSettings(BMessage *msg) status_t PrinterSettings::WriteSettings(BMessage* msg) { - size_t length; + ssize_t length; char *data = NULL; status_t err = B_ERROR; length = msg->FlattenedSize(); + if (length < B_OK) + return length; data = (char *) malloc(length); if (data != NULL) { msg->Flatten(data, length);