From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27836 invoked by alias); 7 Jul 2008 09:36:38 -0000 Received: (qmail 26250 invoked by uid 48); 7 Jul 2008 09:35:58 -0000 Date: Mon, 07 Jul 2008 09:36:00 -0000 Message-ID: <20080707093558.26248.qmail@sourceware.org> From: "halesh dot s at gmail dot com" To: glibc-bugs-regex@sources.redhat.com In-Reply-To: <20080704200314.6722.lists@roberthogan.net> References: <20080704200314.6722.lists@roberthogan.net> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug regex/6722] sscanf bug when parsing lines from /proc/net/tcp X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-regex-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-regex-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00001.txt.bz2 ------- Additional Comments From halesh dot s at gmail dot com 2008-07-07 09:35 ------- Hi Robert, Please check the below testcase.. $cat test.c #include int main() { FILE *f; int locaddr, locport, remaddr, remport, uid, inode; char big_str[256]; f = fopen("/proc/net/tcp", "r"); fgets(big_str,256,f); printf("%s\n", big_str); fgets(big_str,256,f); printf("%s\n", big_str); sscanf(big_str, "%*d: %8x:%4x %8x:%4x %*2x %*8x:%*8x %*2x:%*8x %*8x %d %*d %u \n",&locaddr, (unsigned int *) &locport, &remaddr, (unsigned int *) &remport,&uid, &inode); printf("LocAddr:%d LocPort:%x RemAddr:%x RemPort:%x uid:%d inode:%d \n",locaddr, locport, remaddr, remport, uid, inode); } $ gcc -o test test.c $ ./test sl local_address rem_address st tx_queue rx_queue tr tm->when retrnsmt uid timeout inode 0: 0100007F:1780 00000000:0000 0A 00000000:00000000 00:00000000 00000000 504 0 5488802 1 0df2da80 3000 0 0 2 -1 LocAddr:100007f LocPort:1780 RemAddr:0 RemPort:0 uid:504 inode:5488802 Local port gets stored correctly using sscanf. I have checked with glibc 2.3 and glibc 2.7. I was not able to reproduce. I have checkd for all the enties in tcp file in a loop and worked fine. Please revert back with the problem scenario if my understanding is not correct. -Thanks, Halesh -- http://sourceware.org/bugzilla/show_bug.cgi?id=6722 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.