On Thu, Feb 10, 2011 at 11:01:59PM -0800, Alan Coopersmith wrote: > Signed-off-by: Alan Coopersmith <[email protected]> > --- > setxkbmap.c | 7 +++---- > 1 files changed, 3 insertions(+), 4 deletions(-) > > Updated to apply in series after the newly inserted patch 2/3 that corrects > the rfName argument to the second sprintf, and to propogate that fix to the > new snprintf. > > diff --git a/setxkbmap.c b/setxkbmap.c > index 9f92e2e..6e4a9fd 100644 > --- a/setxkbmap.c > +++ b/setxkbmap.c > @@ -625,14 +625,13 @@ findFileInPath(char *name, char *subdir) > } > for (i = 0; (i < numInclPath); i++) > { > - if ((strlen(inclPath[i]) + strlen(subdir) + strlen(name) + 2) > > + if (snprintf(buf, PATH_MAX, "%s/%s%s", inclPath[i], subdir, name) >= > PATH_MAX) > { > VMSG3(0, "Path too long (%s/%s%s). Ignored.\n", inclPath[i], > subdir, name); > continue; > } > - sprintf(buf, "%s/%s%s", inclPath[i], subdir, name); > fp = fopen(name, "r"); > if ((verbose > 7) || ((!fp) && (verbose > 5))) > MSG2("%s file %s\n", (fp ? "Found" : "Didn't find"), buf); > @@ -844,13 +843,13 @@ applyRules(void) > * we succeed with */ > for (i = 0; (i < numInclPath) && (!rules); i++) > { > - if ((strlen(inclPath[i]) + strlen(rfName) + 8) > PATH_MAX) > + if (snprintf(buf, PATH_MAX, "%s/rules/%s", inclPath[i], > + rfName) >= PATH_MAX) > { > VMSG2(0, "Path too long (%s/rules/%s). Ignored.\n", > inclPath[i], rfName); > continue; > } > - sprintf(buf, "%s/rules/%s", inclPath[i], rfName); > rules = XkbRF_Load(buf, svValue[LOCALE_NDX], True, True); > } > } > -- > 1.7.3.2 >
Reviewed-by: Dirk Wallenstein <[email protected]> -- Greetings, Dirk _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
