Menu

#3 invalid device with ttylog 0.25  Edit

v0.26
closed
0.2.0
1
2015-06-03
2014-02-14
No

dan@cb2b:~# ttylog -v
ttylog version 0.25.
dan@cb2b:~# ttylog -d /dev/ttyUSB0
ttylog: invalid device /d
dan@cb2b:~#

The problem is caused by the additional \0 when copying the argv to the modem_device string. it will always be cut off after 2 chars.

The solution is pretty easy:
dan@cb2b:~# diff -Nur ttylog-code/ttylog.c_orig ttylog-code/ttylog.c
--- ttylog-code/ttylog.c_orig 2014-02-14 23:35:13.311886020 +0000
+++ ttylog-code/ttylog.c 2014-02-14 23:35:48.661886037 +0000
@@ -97,7 +97,7 @@
{
memset (modem_device, '\0', sizeof(modem_device));
strncpy (modem_device, argv[i + 1], sizeof(modem_device)-1);

  • modem_device[i + 1] = '\0';
  • modem_device[(sizeof(modem_device)-1)] = '\0';
    }
    else
    {

(tested on ubuntu linux)

1 Attachments

Related

Patches: #3

Discussion

  • Robert James Clay

     
  • Robert James Clay

    • status: open --> accepted
    • Milestone: BaudRate --> v0.26
     
    • Daniel Andersen

      Daniel Andersen - 2015-06-01

      Thanks a lot :-)

      On 31. Mai 2015 23:26:57 MESZ, Robert James Clay jame@users.sf.net wrote:

      • status: open --> accepted
      • Milestone: BaudRate --> v0.26

      ** [patches:#3] invalid device with ttylog 0.25**

      Status: accepted
      Milestone: v0.26
      Labels: device issue
      Created: Fri Feb 14, 2014 11:40 PM UTC by Daniel Flinkmann
      Last Updated: Tue Jul 29, 2014 10:37 PM UTC
      Owner: Robert James Clay

      dan@cb2b:~# ttylog -v
      ttylog version 0.25.
      dan@cb2b:~# ttylog -d /dev/ttyUSB0
      ttylog: invalid device /d
      dan@cb2b:~#

      The problem is caused by the additional \0 when copying the argv to the
      modem_device string. it will always be cut off after 2 chars.

      The solution is pretty easy:
      dan@cb2b:~# diff -Nur ttylog-code/ttylog.c_orig ttylog-code/ttylog.c
      --- ttylog-code/ttylog.c_orig 2014-02-14 23:35:13.311886020 +0000
      +++ ttylog-code/ttylog.c 2014-02-14 23:35:48.661886037 +0000
      @@ -97,7 +97,7 @@
      {
      memset (modem_device, '\0', sizeof(modem_device));
      strncpy (modem_device, argv[i + 1], sizeof(modem_device)-1);
      - modem_device[i + 1] = '\0';
      + modem_device[(sizeof(modem_device)-1)] = '\0';
      }
      else
      {

      (tested on ubuntu linux)


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/ttylog/patches/3/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      Diese Nachricht wurde von meinem Mobiltelefon mit Kaiten Mail gesendet.

       

      Related

      Patches: #3

  • Robert James Clay

    Implemented patch with commit [f5dc5c] and released today with version v0.26.

     

    Related

    Commit: [f5dc5c]

  • Robert James Clay

    • status: accepted --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





Auth0 Logo