Author Topic: random bugs  (Read 1646 times)

0 Members and 1 Guest are viewing this topic.

adarqui

  • Administrator
  • Hero Member
  • *****
  • Posts: 31236
  • who run it.
  • Respect: +7712
    • View Profile
    • Email
random bugs
« on: April 07, 2013, 04:37:42 pm »
0
lcdproc:

Code: [Select]
// Send/receive lines of text
int
sock_send_string (int fd, char *string)
{
        int len;
        int offset = 0;

        if (!string)
                return -1;

        len = strlen (string) ;
        while (offset != len) {
                // write isn't guaranteed to send the entire string at once,
                // so we have to sent it in a loop like this
                int sent = write (fd, string + offset, len - offset);
                if (sent == -1) {
                        if (errno != EAGAIN) {
                                report (RPT_ERR, "sock_send_string: socket write error");
                                report (RPT_DEBUG, "Message was: %s", string);
                                //shutdown(fd, 2);
                                return sent;
                        }
                        continue;
                } else if (sent == 0) {
                        // when this returns zero, it generally means
                        // we got disconnected
                        return sent + offset;
                }

                offset += sent;
        }

        return offset;
}

adarqui

  • Administrator
  • Hero Member
  • *****
  • Posts: 31236
  • who run it.
  • Respect: +7712
    • View Profile
    • Email
Re: random bugs
« Reply #1 on: April 17, 2013, 01:26:29 am »
0
Code: [Select]
Program terminated with signal 11, Segmentation fault.
#0  memchr () at ../sysdeps/x86_64/memchr.S:33
33      ../sysdeps/x86_64/memchr.S: No such file or directory.
        in ../sysdeps/x86_64/memchr.S
(gdb) bt
#0  memchr () at ../sysdeps/x86_64/memchr.S:33
#1  0x00002abe45c605dd in _IO_getline_info (fp=0x19252a0, buf=<value optimized out>, n=254, delim=10,
    extract_delim=1, eof=0x0) at iogetline.c:99
#2  0x00002abe45c5f4f9 in _IO_fgets (buf=0x7fffaad94100 "", n=<value optimized out>, fp=0x19252a0)
    at iofgets.c:58
#3  0x00002abe459e4f0c in sc2s_fill () from ./sc2s.so
#4  0x0000000000400924 in main ()
Current language:  auto
The current source language is "auto; currently asm".

adarqui

  • Administrator
  • Hero Member
  • *****
  • Posts: 31236
  • who run it.
  • Respect: +7712
    • View Profile
    • Email
Re: random bugs
« Reply #2 on: April 21, 2013, 01:50:02 am »
0
random bug in my own test code that rebooted my box

Code: [Select]
exec: id
PARENT
CHILD
p data { type: 'stdout',
  data: 'PARENT\r\nCHILD\r\nuid=0(root) gid=0(root) groups=0(root),1012(ossec-log-axs),1015(nodans),1016(log-axs),1019(pot)\r\nuid=0(root) gid=0(root) groups=0(root),1012(ossec-log-axs),1015(nodans),1016(log-axs),1019(pot)\r\n',
  len: 209,
  pid: 19570 }

Broadcast message from root@serv (console) (Sun Apr 21 01:38:39 2013):

The system is going down for reboot NOW!
                 
ok