Unless the source code comes with a licence that explicitly allows you what you want to do, you have to get the permission of the current copyright holders to be on the safe side. These may either be the authors of the article, the publisher or both – depending on what copyright transfer happened between the authors and the journal.
However, it is very likely that the authors are fine with you reusing their source code; this may be one of their intentions for publishing it. Authors that have a problem with this, usually do not publish their source code. As a reusing of the source code raises the chance of the paper being cited, the journal is likely to endorse what you want as well.
Thus it is unlikely that anybody sues you, but on the other hand, if you write a mail asking the authors and the journal for permission, you are likely to get a positive answer (and they may consider to equip their code with a permissive licence next time).