--65e39d9c7d0a4f14a47fce0ee4c4c6c4 Content-Type: text/plain; charset="utf-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable awilcox added a comment. > Out of interest: how did you stumble on that code? =20 Using the musl libc, getpass is not defined unless you enable _GNU_SOURCE: =20 [ 75%] Building C object kcheckpass/CMakeFiles/kcheckpass.dir/kcheckpas= s.c.o cd /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5_bui= ld/kcheckpass && /usr/bin/gcc -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=3D600 = -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5_build/kc= heckpass -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5= /kcheckpass -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.= 8.5_build -DQT_NO_DEBUG -DNDEBUG -O2 -mlong-double-64 -ggdb -mcpu=3DG3 -f= no-omit-frame-pointer -std=3Diso9899:1990 -fno-common -Wall -Wextra -Wcast= -align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-arith -= Wundef -Wmissing-format-attribute -Wwrite-strings -Werror=3Dimplicit-functi= on-declaration -std=3Dgnu90 -fvisibility=3Dhidden -U_REENTRANT -o CMakeF= iles/kcheckpass.dir/kcheckpass.c.o -c /usr/src/kde-plasma/kscreenlocker-5.8= .5/work/kscreenlocker-5.8.5/kcheckpass/kcheckpass.c /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheck= pass/kcheckpass.c: In function =E2=80=98conv_legacy=E2=80=99: /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheck= pass/kcheckpass.c:105:10: error: implicit declaration of function =E2=80=98= getpass=E2=80=99 [-Werror=3Dimplicit-function-declaration] p =3D getpass(prompt ? prompt : "Password: "); ^ /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheck= pass/kcheckpass.c:105:8: warning: assignment makes pointer from integer wit= hout a cast [-Wint-conversion] p =3D getpass(prompt ? prompt : "Password: "); ^ cc1: some warnings being treated as errors kcheckpass/CMakeFiles/kcheckpass.dir/build.make:62: recipe for target '= kcheckpass/CMakeFiles/kcheckpass.dir/kcheckpass.c.o' failed make[2]: *** [kcheckpass/CMakeFiles/kcheckpass.dir/kcheckpass.c.o] Erro= r 1 make[2]: Leaving directory '/usr/src/kde-plasma/kscreenlocker-5.8.5/wor= k/kscreenlocker-5.8.5_build' CMakeFiles/Makefile2:2042: recipe for target 'kcheckpass/CMakeFiles/kch= eckpass.dir/all' failed make[1]: *** [kcheckpass/CMakeFiles/kcheckpass.dir/all] Error 2 =20 =20 =20 > If you think there is a risk: better be pedantic in this case. On the o= ther hand getdelim should return -1 in error case and then your method retu= rns null. So in my book that's good enough error checking. =20 My concern was on the off-chance that getdelim reads a partial password b= ut receives EOF before \n so it returns -1. But, looking at the standard, = there is no safe way to read/write to the buffer if the return code is -1, = so that is actually a moot point. REPOSITORY R133 KScreenLocker REVISION DETAIL https://phabricator.kde.org/D4376 EMAIL PREFERENCES https://phabricator.kde.org/settings/panel/emailpreferences/ To: awilcox Cc: graesslin, plasma-devel, lesliezhai, ali-mohamed, jensreuterberg, abett= s, sebas --65e39d9c7d0a4f14a47fce0ee4c4c6c4 Content-Type: text/html; charset="utf-8" Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable View Revision=
awilcox added a comment.

Out of interest: how did you stumbl= e on that code?

Using the musl libc, getpass is not defined unless you enable _GNU_SOURC= E:

[ 75%] Building C object kcheckpass/CMakeFiles/kcheckpass.dir/kch=
eckpass.c.o
cd /usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5_build/k=
checkpass && /usr/bin/gcc  -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=3D=
600 -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5_buil=
d/kcheckpass -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5=
.8.5/kcheckpass -I/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocke=
r-5.8.5_build   -DQT_NO_DEBUG -DNDEBUG -O2 -mlong-double-64 -ggdb -mcpu=3DG=
3 -fno-omit-frame-pointer  -std=3Diso9899:1990 -fno-common -Wall -Wextra -W=
cast-align -Wchar-subscripts -Wformat-security -Wno-long-long -Wpointer-ari=
th -Wundef -Wmissing-format-attribute -Wwrite-strings -Werror=3Dimplicit-fu=
nction-declaration -std=3Dgnu90 -fvisibility=3Dhidden    -U_REENTRANT -o CM=
akeFiles/kcheckpass.dir/kcheckpass.c.o -c /usr/src/kde-plasma/kscreenlocker=
-5.8.5/work/kscreenlocker-5.8.5/kcheckpass/kcheckpass.c
/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheckpass=
/kcheckpass.c: In function =E2=80=98conv_legacy=E2=80=99:
/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheckpass=
/kcheckpass.c:105:10: error: implicit declaration of function =E2=80=98getp=
ass=E2=80=99 [-Werror=3Dimplicit-function-declaration]
      p =3D getpass(prompt ? prompt : "Password: ");
          ^
/usr/src/kde-plasma/kscreenlocker-5.8.5/work/kscreenlocker-5.8.5/kcheckpass=
/kcheckpass.c:105:8: warning: assignment makes pointer from integer without=
 a cast [-Wint-conversion]
      p =3D getpass(prompt ? prompt : "Password: ");
        ^
cc1: some warnings being treated as errors
kcheckpass/CMakeFiles/kcheckpass.dir/build.make:62: recipe for target '=
;kcheckpass/CMakeFiles/kcheckpass.dir/kcheckpass.c.o' failed
make[2]: *** [kcheckpass/CMakeFiles/kcheckpass.dir/kcheckpass.c.o] Error 1
make[2]: Leaving directory '/usr/src/kde-plasma/kscreenlocker-5.8.5/wo=
rk/kscreenlocker-5.8.5_build'
CMakeFiles/Makefile2:2042: recipe for target 'kcheckpass/CMakeFiles/kc=
heckpass.dir/all' failed
make[1]: *** [kcheckpass/CMakeFiles/kcheckpass.dir/all] Error 2

If you think there is a risk: better be pedantic in this case. O= n the other hand getdelim should return -1 in error case and then your meth= od returns null. So in my book that's good enough error checking.

<= /blockquote>

My concern was on the off-chance that getdelim reads a partial password = but receives EOF before \n so it returns -1. But, looking at the standard,= there is no safe way to read/write to the buffer if the return code is -1,= so that is actually a moot point.


REPOSI= TORY
R133 KScreenLocker

REVISION DETAIL
https://phabricator.kde.org/D4376

EMAIL PREFERENCES
https://phab= ricator.kde.org/settings/panel/emailpreferences/

= To: awilcox
Cc: graesslin, plasma-de= vel, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas
--65e39d9c7d0a4f14a47fce0ee4c4c6c4--