mirror of
https://github.com/qmk/qmk_firmware
synced 2024-11-18 09:55:48 +00:00
Improve security of avrdude by eliminating the use of well-known names. (#9026)
* Improve security by eliminating the use of well-known names. * Add an additional $ so the shell expands $TMP1 and $TMP2 Co-authored-by: Joel Challis <git@zvecr.com> Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
parent
3beda5c16e
commit
640d12d070
1 changed files with 8 additions and 5 deletions
|
@ -156,17 +156,20 @@ dfu-split-right: $(BUILD_DIR)/$(TARGET).hex cpfirmware check-size
|
||||||
define EXEC_AVRDUDE
|
define EXEC_AVRDUDE
|
||||||
USB= ;\
|
USB= ;\
|
||||||
if $(GREP) -q -s Microsoft /proc/version; then \
|
if $(GREP) -q -s Microsoft /proc/version; then \
|
||||||
echo 'ERROR: AVR flashing cannot be automated within the Windows Subsystem for Linux (WSL) currently. Instead, take the .hex file generated and flash it using AVRDUDE, AVRDUDESS, or XLoader.'; \
|
echo 'ERROR: AVR flashing cannot be automated within the Windows Subsystem for Linux (WSL) currently. Instead, take the .hex file generated and flash it using QMK Toolbox, AVRDUDE, AVRDUDESS, or XLoader.'; \
|
||||||
else \
|
else \
|
||||||
printf "Detecting USB port, reset your controller now."; \
|
printf "Detecting USB port, reset your controller now."; \
|
||||||
ls /dev/tty* > /tmp/1; \
|
TMP1=`mktemp`; \
|
||||||
|
TMP2=`mktemp`; \
|
||||||
|
ls /dev/tty* > $$TMP1; \
|
||||||
while [ -z $$USB ]; do \
|
while [ -z $$USB ]; do \
|
||||||
sleep 0.5; \
|
sleep 0.5; \
|
||||||
printf "."; \
|
printf "."; \
|
||||||
ls /dev/tty* > /tmp/2; \
|
ls /dev/tty* > $$TMP2; \
|
||||||
USB=`comm -13 /tmp/1 /tmp/2 | $(GREP) -o '/dev/tty.*'`; \
|
USB=`comm -13 $$TMP1 $$TMP2 | $(GREP) -o '/dev/tty.*'`; \
|
||||||
mv /tmp/2 /tmp/1; \
|
mv $$TMP2 $$TMP1; \
|
||||||
done; \
|
done; \
|
||||||
|
rm $$TMP2 $$TMP1; \
|
||||||
echo ""; \
|
echo ""; \
|
||||||
echo "Device $$USB has appeared; assuming it is the controller."; \
|
echo "Device $$USB has appeared; assuming it is the controller."; \
|
||||||
if $(GREP) -q -s 'MINGW\|MSYS' /proc/version; then \
|
if $(GREP) -q -s 'MINGW\|MSYS' /proc/version; then \
|
||||||
|
|
Loading…
Reference in a new issue