Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os.date() appends null terminator (\0) to ISO 8601 UTC timestamp in sandboxed Lua 5.4 #3144

Open
Azael-Dev opened this issue Feb 8, 2025 · 0 comments
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action

Comments

@Azael-Dev
Copy link

Azael-Dev commented Feb 8, 2025

What happened?

Starting from FXServer 12767, using os.date("!%Y-%m-%dT%H:%M:%SZ", os.time()) with UTC formatting appends a null terminator (<\0>) at the end of the string.

Expected result

os.date("!%Y-%m-%dT%H:%M:%SZ", os.time()) should return a valid ISO 8601 timestamp without a null terminator (<\0>).

Reproduction steps

  1. Run the following Lua script on FXServer 12767+:
     print("ISO 8601 (UTC):", os.date("!%Y-%m-%dT%H:%M:%SZ"))
     print("ISO 8601 (LOCAL):", os.date("%Y-%m-%dT%H:%M:%SZ"))
     print("Standard Date:", os.date("%c"))
     print("YYYY-MM-DD:", os.date("%Y-%m-%d"))
     print("24-hour Time:", os.date("%H:%M:%S"))
     print("12-hour Time:", os.date("%I:%M:%S %p"))
     print("Day of the Week:", os.date("%A"))
     print("Day of the Year:", os.date("%j"))
  2. Observe the output (Bug):
     ISO 8601 (UTC):	2025-02-11T07:34:57Z<\0>
     ISO 8601 (LOCAL):	2025-02-11T14:34:57Z
     Standard Date:	Tue Feb 11 14:34:57 2025
     YYYY-MM-DD:	2025-02-11
     24-hour Time:	14:34:57
     12-hour Time:	02:34:57 PM
     Day of the Week:	Tuesday
     Day of the Year:	042
    
  3. This issue occurs in sandboxed Lua 5.4 and affects timestamps formatted in ISO 8601 (!%Y-%m-%dT%H:%M:%SZ), causing an unexpected null terminator (<\0>) at the end of the string.

Importancy

There's a workaround

Area(s)

FXServer

Specific version(s)

Server 12767 windows

Additional information

This issue was introduced by commit: 76d4fc0

@Azael-Dev Azael-Dev added bug triage Needs a preliminary assessment to determine the urgency and required action labels Feb 8, 2025
@Azael-Dev Azael-Dev changed the title os.date() appends null terminator (\0) when using ISO 8601 format in sandboxed Lua 5.4 os.date() appends null terminator (\0) to ISO 8601 UTC timestamp in sandboxed Lua 5.4 Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Needs a preliminary assessment to determine the urgency and required action
Projects
None yet
Development

No branches or pull requests

1 participant