Can I upload a modified version of a code from a journal paper to Github?
The answer to your question depends entirely on the license of the "small external program (not yours)".  Where did it come from?  Find its source and read the terms of the license.

If it's an open source license or a free software license, usually you are permitted to redistribute it so long as you preserve attribution and license terms in the code header.  If it's a different type of license, then it will depend entirely on the content of the license, which acts like a contract between the author and yourself.

UPDATE w/ JOURNAL SPECIFIC DETAILS:

The Journal of Computers &amp; Geosciences is published by Elsevier who has an open access publishing option for authors.  If the paper in question was published as open access, and its chosen license was CC-BY, then that gives you permission to reuse the work (including the attached source-code) so long as you provide attribution.  If the article in question wasn't published as open access, then you'll have to contact the authors or locate another source for the code that has clear licensing terms.