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

Fix PROXY command bug #218

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexanderEpolite
Copy link

When PROXY is enabled, you can simply send:

PROXY IPV4 1.1.1.1

and the entire process will exit, with the error:

389 |                                         proxy: params[1].trim().toLowerCase()
390 |                                     },
391 |                                     '[%s] PROXY from %s through %s (%s)',
392 |                                     socketOptions.id,
393 |                                     params[1].trim().toLowerCase(),
394 |                                     params[2].trim().toLowerCase(),
                                                 ^
TypeError: undefined is not an object (evaluating 'params[2].trim')
      at socketReader (/mnt/c/Users/Alex/<private>/node_modules/smtp-server/lib/smtp-server.js:394:44)
      at emit (node:events:84:22)
      at emitReadable_ (internal:streams/readable:396:16)

This patch puts a try catch block around the problematic code, and returning an error to the sender if it is invalid.

The reason this happened in the first place is because params[2] was never checked to see if it was valid. Might be worth doing a manual check, but this does fix the issue.

Note: this is not too severe of a bug, as most people have proxy off, and the proxy would send correct data to begin with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant