зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1308104 - Replace PL_strchr with a safer Gecko string class or function netwerk/ r=necko-reviewers,dragana
Differential Revision: https://phabricator.services.mozilla.com/D89326
This commit is contained in:
Родитель
7576762235
Коммит
eb33e0f63f
|
@ -2536,7 +2536,7 @@ nsStandardURL::Resolve(const nsACString& in, nsACString& out) {
|
|||
// locate result path
|
||||
resultPath = PL_strstr(result, "://");
|
||||
if (resultPath) {
|
||||
resultPath = PL_strchr(resultPath + 3, '/');
|
||||
resultPath = strchr(resultPath + 3, '/');
|
||||
if (resultPath) {
|
||||
net_CoalesceDirs(coalesceFlag, resultPath);
|
||||
}
|
||||
|
|
|
@ -572,8 +572,8 @@ nsresult nsMIMEHeaderParamImpl::DoParameterInternal(
|
|||
// in quotes (quotes required even if lang is blank)
|
||||
if (caseB || (caseCStart && acceptContinuations)) {
|
||||
// look for single quotation mark(')
|
||||
const char* sQuote1 = PL_strchr(valueStart, 0x27);
|
||||
const char* sQuote2 = sQuote1 ? PL_strchr(sQuote1 + 1, 0x27) : nullptr;
|
||||
const char* sQuote1 = strchr(valueStart, 0x27);
|
||||
const char* sQuote2 = sQuote1 ? strchr(sQuote1 + 1, 0x27) : nullptr;
|
||||
|
||||
// Two single quotation marks must be present even in
|
||||
// absence of charset and lang.
|
||||
|
@ -751,7 +751,7 @@ nsresult internalDecodeRFC2047Header(const char* aHeaderVal,
|
|||
Is7bitNonAsciiString(aHeaderVal, strlen(aHeaderVal))))) {
|
||||
DecodeRFC2047Str(aHeaderVal, aDefaultCharset, aOverrideCharset, aResult);
|
||||
} else if (aEatContinuations &&
|
||||
(PL_strchr(aHeaderVal, '\n') || PL_strchr(aHeaderVal, '\r'))) {
|
||||
(strchr(aHeaderVal, '\n') || strchr(aHeaderVal, '\r'))) {
|
||||
aResult = aHeaderVal;
|
||||
} else {
|
||||
aEatContinuations = false;
|
||||
|
@ -1167,7 +1167,9 @@ nsresult DecodeRFC2047Str(const char* aHeader,
|
|||
if (isLastEncodedWord) {
|
||||
// See if it's all whitespace.
|
||||
for (q = begin; q < p; ++q) {
|
||||
if (!PL_strchr(" \t\r\n", *q)) break;
|
||||
if (!strchr(" \t\r\n", *q)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1193,7 +1195,7 @@ nsresult DecodeRFC2047Str(const char* aHeader,
|
|||
charsetStart = p;
|
||||
charsetEnd = nullptr;
|
||||
for (q = p; *q != '?'; q++) {
|
||||
if (*q <= ' ' || PL_strchr(especials, *q)) {
|
||||
if (*q <= ' ' || strchr(especials, *q)) {
|
||||
goto badsyntax;
|
||||
}
|
||||
|
||||
|
|
|
@ -852,7 +852,7 @@ void LogHeaders(const char* lineStart) {
|
|||
if (StaticPrefs::network_http_sanitize_headers_in_logs() &&
|
||||
(PL_strcasestr(buf.get(), "authorization: ") ||
|
||||
PL_strcasestr(buf.get(), "proxy-authorization: "))) {
|
||||
char* p = PL_strchr(buf.get(), ' ');
|
||||
char* p = strchr(buf.get(), ' ');
|
||||
while (p && *++p) {
|
||||
*p = '*';
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include <errno.h>
|
||||
#include "nsHttpChunkedDecoder.h"
|
||||
#include <algorithm>
|
||||
#include "plstr.h"
|
||||
|
||||
#include "mozilla/Unused.h"
|
||||
|
||||
|
@ -135,7 +134,9 @@ nsresult nsHttpChunkedDecoder::ParseChunkRemaining(char* buf, uint32_t count,
|
|||
unsigned long parsedval; // could be 64 bit, could be 32
|
||||
|
||||
// ignore any chunk-extensions
|
||||
if ((p = PL_strchr(buf, ';')) != nullptr) *p = 0;
|
||||
if ((p = strchr(buf, ';')) != nullptr) {
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
// mChunkRemaining is an uint32_t!
|
||||
parsedval = strtoul(buf, &endptr, 16);
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
|
||||
#include "nsFTPDirListingConv.h"
|
||||
#include "nsMemory.h"
|
||||
#include "plstr.h"
|
||||
#include "mozilla/Logging.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsEscape.h"
|
||||
|
@ -229,7 +228,7 @@ char* nsFTPDirListingConv::DigestBufferLines(char* aBuffer,
|
|||
list_state state;
|
||||
|
||||
// while we have new lines, parse 'em into application/http-index-format.
|
||||
while (line && (eol = PL_strchr(line, nsCRT::LF))) {
|
||||
while (line && (eol = strchr(line, nsCRT::LF))) {
|
||||
// yank any carriage returns too.
|
||||
if (eol > line && *(eol - 1) == nsCRT::CR) {
|
||||
eol--;
|
||||
|
|
Загрузка…
Ссылка в новой задаче