summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWan-Teh Chang <wtc@google.com>2015-07-15 14:20:10 -0700
committerWan-Teh Chang <wtc@google.com>2015-07-15 14:20:10 -0700
commitc1f8adeeee2d3610b2b727bd06c67213be6c71ed (patch)
treef3aaae4497b229d71f0052acaf37916bbd2ff979
parentd960f75cf9cdd0d24f3c7cecc32d95afb5137825 (diff)
downloadnspr-hg-c1f8adeeee2d3610b2b727bd06c67213be6c71ed.tar.gz
Bug 1174781: Check the return value of PR_sscanf. r=ted.
-rw-r--r--pr/src/misc/prinit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pr/src/misc/prinit.c b/pr/src/misc/prinit.c
index 5eda4a2a..43048a0d 100644
--- a/pr/src/misc/prinit.c
+++ b/pr/src/misc/prinit.c
@@ -642,7 +642,10 @@ PR_IMPLEMENT(PRFileDesc *) PR_GetInheritedFD(
while (1) {
if ((ptr[len] == ':') && (strncmp(ptr, name, len) == 0)) {
ptr += len + 1;
- PR_sscanf(ptr, "%d:0x%" PR_SCNxOSFD, &fileType, &osfd);
+ if (PR_sscanf(ptr, "%d:0x%" PR_SCNxOSFD, &fileType, &osfd) != 2) {
+ PR_SetError(PR_UNKNOWN_ERROR, 0);
+ return NULL;
+ }
switch ((PRDescType)fileType) {
case PR_DESC_FILE:
fd = PR_ImportFile(osfd);