Jump to content

Sanitizing eval() correctly


Nolongerused3921

Recommended Posts

I'm currently working on a template engine, and I need to know what needs to be escape before a string is considered safe for eval... Right now I'm placing anything that will be executed into a print, in quotes... And before that, I use addslashes()... And [b]just[/b] in case, I remove any ;'s when a variable is added into the variable array...

Is this enough? Or do I need more. The variables the templates will have access to may contain user editable content.

All this aside, I'm not sure if I even need sanitation, as I'm just reading a template, replacing any {$variable}'s with $template->vars[variable]... Could this be at all exploited?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.