You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I agree this is not really a Scapy issue. But I think it could be useful to catch errors when creating a datetime from a timestamp.
For example, on every OS, calling datetime.frometimestamp(2**43)will trigger an error. So if a layer contains a UTCTimeField attribute based on a 64 bits value (I don't know if it could happen), this could lead to an error on every OS.
How to reproduce
The following packet will trigger an error when displayed in a Windows environment :
>>> p = Ether(binascii.unhexlify('00155d56b60100155d56b6030800450201246bfe4000800677b90a02010d0a02010a01bdc13df3830c636c7a265c50182003bece0000000000f8fe534d4240000000000000000000010001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041000100ff020000071c1e4cf44fa749a15341d7b30ed5cb07000000000080000000800000008000845dc27b5d6bda0100000000000000008000780000000000607606062b0601050502a06c306aa03c303a060a2b06010401823702021e06092a864882f71201020206092a864886f712010202060a2a864886f71201020203060a2b06010401823702020aa32a3028a0261b246e6f745f646566696e65645f696e5f5246433431373840706c656173655f69676e6f7265'))
In this packet, the error comes from the ServerStartTime attribute from the SMB2 Negotiate response which is null.
Brief description
On a Windows,
UTCTimeField.i2repr(self, pkt, x
) will trigger an error if x is a negative value.Scapy version
2.5.0
Python version
3.11 (tester on 3.10 also)
Operating system
Windows 10
Additional environment information
This comes from
datetime.fromtimestamp(t)
which will throw an errror on Windows ift
is negative :I agree this is not really a Scapy issue. But I think it could be useful to catch errors when creating a
datetime
from a timestamp.For example, on every OS, calling
datetime.frometimestamp(2**43)
will trigger an error. So if a layer contains aUTCTimeField
attribute based on a 64 bits value (I don't know if it could happen), this could lead to an error on every OS.How to reproduce
The following packet will trigger an error when displayed in a Windows environment :
In this packet, the error comes from the ServerStartTime attribute from the SMB2 Negotiate response which is null.
Actual result
Expected result
On Linux, you can see how it is rendered :
we can see the ServerStartTime attribute being equal to
-11644473600
, which explains the error on Windows ...Related resources
No response
The text was updated successfully, but these errors were encountered: