Live data from Hacker News

Show HN: X11 desktop widget that shows location of your network peers on a map

github.com

31–40 of 90 posts

Re: Show HN: X11 desktop widget that shows location of your network peers on a map

#31
post #4
post #3

No basically secure: char mapFilename[256]; strcat(strcpy(mapFilename, getenv("HOME")), RESOURCES); strcat(mapFilename, mapName);

What's insecure? Can you explain what's the vulnerability here and how and by whom can it be exploited?

Using strcat to a fixed size buffer is like using a gun to kill flies in a crowded flophouse while on crystal meth.

Re: Show HN: X11 desktop widget that shows location of your network peers on a map

#33
post #3

No basically secure: char mapFilename[256]; strcat(strcpy(mapFilename, getenv("HOME")), RESOURCES); strcat(mapFilename, mapName);

While that's indeed a bug, for it to be a security vulnerability, wouldn't there also have to be a security boundary involved? Specifically, mapName is always either "w1000b.png" or "w1000.png", so the only way to trigger the buffer overflow would be through the HOME environment variable. But if an attacker can run commands as you with arbitrary environment variables, aren't you already pwned? What would anyone gain…

While exploitation is unlikely I think such things are still best avoided because multiple such things can sometimes be chained together.

Re: Show HN: X11 desktop widget that shows location of your network peers on a map

#35
This is some old school style bare bones C. popen with a big old pipe chain is pretty quick n dirty. I’d have gone digging around in proc for the active connections. Cool stuff though. I like that it’s so straightforward to read.

Re: Show HN: X11 desktop widget that shows location of your network peers on a map

#37
post #17

Earlier quoted context omitted.

Those 3 dots are your peers, the other end of the TCP connection :) So you basically have some apps running in the background (or foreground) that are making those connections.

Okay, got it, thanks. I suppose it could also be the FIOS router itself making those connections, or any of the other systems on my local network.

You might be surprised how much traffic every device makes.

Re: Show HN: X11 desktop widget that shows location of your network peers on a map

#38
post #14

Earlier quoted context omitted.

Yeah, that is not a helpful attitude to take when it comes to this sort of thing. If nothing else, a super-long home path can crash your app and leave your user scratching their head. In other words, this is a bug (as is the fact that paths are not necessarily limited to 255 characters in the first place; see the PATH_MAX constant, I think it is?). As to what could be accomplished with an overflow? I don't know; I'm…

Thanks for the discussion. Fix is already committed.

As long as you’re fixing that bug, you should do it right. If the return value from snprintf if more than 256 but less than a few GB then you should malloc a buffer big enough to hold the string and then call snprintf again with the new buffer. Only if that or malloc fails would you print an error. (It’s really a shame that the C standard library requires so many extra steps to do things correctly; this ought to be way easier.)
Post reply on HN