Re: OF_getpropstr()

2023-04-08 Thread Todd C . Miller
On Sat, 08 Apr 2023 08:48:31 -0600, "Theo de Raadt" wrote: > Mark Kettenis wrote: > > > > +{ > > > + int len; > > > + > > > + len = OF_getprop(handle, prop, buf, buflen); > > > + if (buflen > 0) > > > + buf[min(len, buflen - 1)] = '\0'; > > > + > > > + return (len); > > > > I've mailed

Re: OF_getpropstr()

2023-04-08 Thread Theo de Raadt
Mark Kettenis 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

Re: OF_getpropstr()

2023-04-08 Thread Mark Kettenis
> Date: Sat, 8 Apr 2023 13:29:25 +1000 > From: David Gwynne > > turns out OF_getprop is like memcpy, but sometimes you want something > like strlcpy. this is what OF_getpropstr aims to provide. > > i know openfirm.h is used on other archs that don't use fdt as their >

OF_getpropstr()

2023-04-07 Thread David Gwynne
turns out OF_getprop is like memcpy, but sometimes you want something like strlcpy. this is what OF_getpropstr aims to provide. i know openfirm.h is used on other archs that don't use fdt as their backend, but i figure we can port this wrapper over to them as need demands. ok? Index: fdt.c