]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Make POSIXification in exec_pair_to_env() notice lower case first char (#4458)
authorJames Jones <jejones3141@gmail.com>
Wed, 13 Apr 2022 20:46:25 +0000 (15:46 -0500)
committerGitHub <noreply@github.com>
Wed, 13 Apr 2022 20:46:25 +0000 (16:46 -0400)
The loop as written always incremented p after the test to deal with
leading digits, so it wouldn't notice a leading lower case letter.

src/lib/server/exec.c

index 7e35562d10eadf5816f52265cc8f4802d9298624..adac648e44277c914d4b8ac468a9380fa5acd8d3 100644 (file)
@@ -154,8 +154,8 @@ static int exec_pair_to_env(char **env_p, size_t env_len, fr_sbuff_t *env_sbuff,
                 *      for the first char.
                 */
                p = fr_sbuff_current(&env_m[i]);
-               if (isdigit((int)*p)) *p = '_';
-               while (p++ < fr_sbuff_current(&sbuff)) {
+               if (isdigit((int)*p)) *p++ = '_';
+               for (; p < fr_sbuff_current(&sbuff); p++) {
                        if (isalpha((int)*p)) *p = toupper(*p);
                        else if (*p == '-') *p = '_';
                        else if (isdigit((int)*p)) continue;