On Mon, Mar 10, 2008 at 2:59 PM, Sarah Jelinek <Sarah.Jelinek at sun.com> wrote:
> Hi Mike, Jan and Sundar,
>
> Please take a look at my updated webrev for Bug 135 .bashrc owned by root:
>
> http://cr.opensolaris.org/~sjelinek/bashrc_root/
I like this approach a lot more.
I'm not worried about this doing the wrong thing in this code path,
but...
1959 (void) snprintf(user_path, sizeof (user_path), "%s/%s/%s/%s",
1960 target, home, save_login_name, bashrc);
1961
1962 (void) snprintf(cmd, sizeof (cmd),
1963 "/bin/sed -e 's/^PATH/%s &/' %s >%s",
1964 "export", profile, user_path);
My inclination (don't know about Sun's real standards around this)
would be to not run sed if snprintf returned a value greater than
sizeof(user_path). That is:
if (snprintf(user_path, sizeof (user_path), "%s/%s/%s/%s",
target, home, save_login_name, bashrc) > sizeof(user_path)) {
/* log something? */
return;
}
(void) snprintf(cmd, sizeof (cmd),
"/bin/sed -e 's/^PATH/%s &/' %s >%s",
"export", profile, user_path);
And another nit:
$ cstyle perform_slim_install.c
perform_slim_install.c: 2021: line > 80 characters
Sorry for missing these on the first pass!
Mike
--
Mike Gerdts
http://mgerdts.blogspot.com/