Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when changing password with chpasswd #514

Closed
juyin opened this issue Mar 30, 2022 · 2 comments
Closed

Segmentation fault when changing password with chpasswd #514

juyin opened this issue Mar 30, 2022 · 2 comments

Comments

@juyin
Copy link
Contributor

juyin commented Mar 30, 2022

When running the following command, chpasswd segfaults:
echo "test:test" | chpasswd -R /home/juyin/rootfs

The backtrace:
(gdb) bt
#0 0x00007f26ab9ba570 in fread () from /lib64/libc.so.6
#1 0x00000000004040dc in read_random_bytes () at salt.c:179
#2 0x000000000040438a in gensalt (salt_size=16) at salt.c:440
#3 0x0000000000404652 in crypt_make_salt (meth=0x0, arg=0x0) at salt.c:559
#4 0x00000000004036a9 in main (argc=3, argv=0x7ffc6950ab88) at chpasswd.c:539

@ikerexxe
Copy link
Collaborator

I guess this is happening because chpasswd is unable to open /dev/urandom in salt.c#L177, but we aren't checking the return value. Is the aforementioned file available on your system?

@juyin
Copy link
Contributor Author

juyin commented Mar 30, 2022

I guess this is happening because chpasswd is unable to open /dev/urandom in salt.c#L177, but we aren't checking the return value. Is the aforementioned file available on your system?

Year, the file ‘/dev/urandom’ exists in my Linux.
But, when chpasswd is used with '-R /home/juyin/rootfs', it will be changed the root directory to '/home/juyin/rootfs'.
The file '/home/juyin/rootfs/etc/urandom' doesn't exist.

@hallyn hallyn closed this as completed in 3732cf7 Apr 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants