Mark Kettenis <mark.kette...@xs4all.nl> wrote: > > +{ > > + int len; > > + > > + len = OF_getprop(handle, prop, buf, buflen); > > + if (buflen > 0) > > + buf[min(len, buflen - 1)] = '\0'; > > + > > + return (len); >
I've mailed dlg seperately, but will raise it here also. If buflen is 0, then why call OF_getprop at all? I doubt this situation occurs, but you want to protect against it, ok.... Maybe in the end if looks like this: int len = 0; if (buflen > 0) { len = OF_getprop(handle, prop, buf, buflen - 1); buf[min(len, buflen - 1)] = '\0'; } return (len); OF_getprop() is now being called with buflen -1, which can avoid one extra character of processing effort for a long input string.