--- src/pic/device.c 2007/09/18 22:04:53 4919 +++ src/pic/device.c 2007/09/27 22:48:03 4920 @@ -278,10 +278,14 @@ /* read line by line */ pic_buf[sizeof(pic_buf)-1] = '\0'; while (fgets(pic_buf, sizeof(pic_buf)-1, pic_file) != NULL && !done) { + unsigned llen; + llen = strlen (pic_buf); /* remove trailing spaces */ - while (isspace(pic_buf[strlen(pic_buf)-1])) - pic_buf[strlen(pic_buf)-1] = '\0'; + while (llen && isspace(pic_buf[llen-1])) { + pic_buf[llen-1] = '\0'; + llen--; + } /* remove leading spaces */ for (pic_buf_pos = pic_buf; isspace(*pic_buf_pos); pic_buf_pos++) --- src/pic/pcoderegs.c 2007/09/18 22:04:53 4919 +++ src/pic/pcoderegs.c 2007/09/27 22:48:03 4920 @@ -848,7 +848,7 @@ } } - rset1 = rset1->next; + rset1 = rset2; } } }