You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "Leif Hedstrom (JIRA)" <ji...@apache.org> on 2015/03/31 05:14:53 UTC

[jira] [Updated] (TS-3305) Minor bugs in ats lua plugin

     [ https://issues.apache.org/jira/browse/TS-3305?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leif Hedstrom updated TS-3305:
------------------------------
    Summary: Minor bugs in ats lua plugin  (was: minor bugs in ats lua plugin)

> Minor bugs in ats lua plugin
> ----------------------------
>
>                 Key: TS-3305
>                 URL: https://issues.apache.org/jira/browse/TS-3305
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Lua, Plugins
>            Reporter: Kit Chan
>            Assignee: Kit Chan
>              Labels: review
>             Fix For: 5.3.0
>
>         Attachments: TS-3305.patch
>
>
> a minor bugs in ATS lua plugin, 
> In plugins/experimental/ts_lua/ts_lua.c line 89:
>   if (fn) {
>     sprintf(conf->script, "%s", argv[2]);
>   } else {
>     conf->content = argv[2];
>   }
> line: 358
>   sprintf(conf->script, "%s", argv[1]);
> "sprintf" is extremely dangerous and deprecated ,should be replaced with "snprintf". 
> And it would be better ( less confused ) if a '\0' is always added to the buffer after strncpy:
> e.g:
> if (argc < 3) {
>     strncpy(errbuf, "[TSRemapNewInstance] - lua script file or string is required !!", errbuf_size - 1);
>     return TS_ERROR;
>   }
> Should be:
> if (argc < 3) {
>     strncpy(errbuf, "[TSRemapNewInstance] - lua script file or string is required !!", errbuf_size - 1);
>     errbuf[errbuf_size - 1] = '\0';
>     return TS_ERROR;
> }
> Because strncpy doesn't guarantee null-termination. Now it works just because errbuf is large enough(2048 bytes)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)