Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
faad6bbe
Kaydet (Commit)
faad6bbe
authored
Ara 06, 2014
tarafından
Benjamin Peterson
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
in poplib, limit maximum line length that we read from the network (closes #16041)
Patch from Berker Peksag.
üst
91f04dd6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
1 deletion
+18
-1
poplib.py
Lib/poplib.py
+11
-1
test_poplib.py
Lib/test/test_poplib.py
+4
-0
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/poplib.py
Dosyayı görüntüle @
faad6bbe
...
...
@@ -32,6 +32,12 @@ CR = '\r'
LF
=
'
\n
'
CRLF
=
CR
+
LF
# maximal line length when calling readline(). This is to prevent
# reading arbitrary length lines. RFC 1939 limits POP3 line length to
# 512 characters, including CRLF. We have selected 2048 just to be on
# the safe side.
_MAXLINE
=
2048
class
POP3
:
...
...
@@ -103,7 +109,9 @@ class POP3:
# Raise error_proto('-ERR EOF') if the connection is closed.
def
_getline
(
self
):
line
=
self
.
file
.
readline
()
line
=
self
.
file
.
readline
(
_MAXLINE
+
1
)
if
len
(
line
)
>
_MAXLINE
:
raise
error_proto
(
'line too long'
)
if
self
.
_debugging
>
1
:
print
'*get*'
,
repr
(
line
)
if
not
line
:
raise
error_proto
(
'-ERR EOF'
)
octets
=
len
(
line
)
...
...
@@ -365,6 +373,8 @@ else:
match
=
renewline
.
match
(
self
.
buffer
)
while
not
match
:
self
.
_fillBuffer
()
if
len
(
self
.
buffer
)
>
_MAXLINE
:
raise
error_proto
(
'line too long'
)
match
=
renewline
.
match
(
self
.
buffer
)
line
=
match
.
group
(
0
)
self
.
buffer
=
renewline
.
sub
(
''
,
self
.
buffer
,
1
)
...
...
Lib/test/test_poplib.py
Dosyayı görüntüle @
faad6bbe
...
...
@@ -198,6 +198,10 @@ class TestPOP3Class(TestCase):
113
)
self
.
assertEqual
(
self
.
client
.
retr
(
'foo'
),
expected
)
def
test_too_long_lines
(
self
):
self
.
assertRaises
(
poplib
.
error_proto
,
self
.
client
.
_shortcmd
,
'echo +
%
s'
%
((
poplib
.
_MAXLINE
+
10
)
*
'a'
))
def
test_dele
(
self
):
self
.
assertOK
(
self
.
client
.
dele
(
'foo'
))
...
...
Misc/NEWS
Dosyayı görüntüle @
faad6bbe
...
...
@@ -10,6 +10,9 @@ What's New in Python 2.7.9?
Library
-------
- Issue #16041: In poplib, limit maximum line length read from the server to
prevent CVE-2013-1752.
- Issue #22960: Add a context argument to xmlrpclib.ServerProxy.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment