Commit 8675f04a authored by jam@chromium.org's avatar jam@chromium.org

Fix some links in PDFs not working.

We were adding an extra null into the string because FPDFLink_GetURL only gives the length without the null terminator.

BUG=pdfium:6
R=thestig@chromium.org

Review URL: https://codereview.chromium.org/316233002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275439 0039d316-1c4b-4281-b951-d872f2087c98
parent abe0dc72
...@@ -388,9 +388,9 @@ void PDFiumPage::CalculateLinks() { ...@@ -388,9 +388,9 @@ void PDFiumPage::CalculateLinks() {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
base::string16 url; base::string16 url;
int url_length = FPDFLink_GetURL(links, i, NULL, 0); int url_length = FPDFLink_GetURL(links, i, NULL, 0);
if (url_length > 0) { if (url_length > 1) { // WriteInto needs at least 2 characters.
unsigned short* data = unsigned short* data =
reinterpret_cast<unsigned short*>(WriteInto(&url, url_length + 1)); reinterpret_cast<unsigned short*>(WriteInto(&url, url_length));
FPDFLink_GetURL(links, i, data, url_length); FPDFLink_GetURL(links, i, data, url_length);
} }
Link link; Link link;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment