Nп/п : 36 из 100
 От   : Ralf Fassel                         2:5075/128        15 сен 23 16:12:56
 К    : The Natural Philosopher                               15 сен 23 17:16:02
 Тема : Re: Weird code crash
----------------------------------------------------------------------------------
                                                                                 
@MSGID: <yga8r97ikyf.fsf@akutech.de> 1225e3bb
@REPLY: 2@dont-email.me> 1042da04
@REPLYADDR Ralf Fassel <ralfixx@gmx.de>
@REPLYTO 2:5075/128 Ralf Fassel
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID: <yga8r97ikyf.fsf@akutech.de>
@RFC-References: 1@dont-email.me>
<ygamsxoixhx.fsf@akutech.de>4@dont-email.me> <ygail8biyxm.fsf@akutech.de>1@dont-email.me>
<ygaedizitb9.fsf@akutech.de>2@dont-email.me>
@TZUTC: 0200
@PID: Gnus/5.13 (Gnus v5.13) Emacs/27.2
(gnu/linux)
@TID: FIDOGATE-5.12-ge4e8b94
* The Natural Philosopher <tnp@invalid.invalid>
| > | if(len=strncmp(filbuf,"ZONE",4)) //supposed to reject
| > | a file whose contents do not start with ZONE
| > | goto baddata;
| > | 
| > | // looking very much like a temperature file
| > | i=(int)filbuf[4] -`1`; // this is our zone from
| > | "ZONE2" etc. 1-4 is zone but index is 0-3 so subtract
| > | `1`
| > The access of filbuf[4] is ok (since you checked that there are at
| > least
| > 4 characters in the file), but what if nothing follows after the `ZONE`,
| > or ZONE is followed by anything but [1-4]?
>
| That cannot happen. Its hard wired into the code that writes the file

Depending on the permissions of VOLATILE_DIR, it *might* be possible
that *anybody* can drop files in there.  Save some "// skip known
bollocks", you just scan every file in VOLATILE_DIR.  If I were an
attacker, I sure would try to use that vector, regardless whether the
program in question runs with elevated permissions or not ;-)

| > Other than that, I really would have it running under a debugger or
| > valgrind, since then *if* it crashes, you *know* *where* in your code it
| > crashes.
| > 
| Last resort. I have to learn how to *use* those tools.

With valgrind, it is as easy as putting `valgrind` in front of the
commandline you use to start your program.  With gdb, it is a tiny bit
more complicated, agreed.  But since these tools are worth learning
anyway for any programmer, the time invested in learning them is not
wasted.

R`
--- Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux)
 * Origin: usenet.network (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх