php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42556 snmpget() on win32 returns wrong strings (backslash/escaping problem)
Submitted: 2007-09-05 08:22 UTC Modified: 2008-11-03 01:00 UTC
Votes:7
Avg. Score:4.6 ± 0.7
Reproduced:6 of 6 (100.0%)
Same Version:5 (83.3%)
Same OS:5 (83.3%)
From: bugs dot php dot net at marnik dot org Assigned:
Status: No Feedback Package: SNMP related
PHP Version: 5CVS-2007-09-05 (snap) OS: win32 only
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
30 + 1 = ?
Subscribe to this entry?

 
 [2007-09-05 08:22 UTC] bugs dot php dot net at marnik dot org
Description:
------------
When using snmpget() on Windows 2003 or Windows XP to retrieve strings wrong strings are returned when they contain backslashes (for example when Paths are used).

Setting the string works fine, but when there are x number of backslahes in the strings, when using snmpget() to retrieve this string, the last x number of characters are missing and the backslashes \ are replaced with \\.

It looks like the stringlength is calculated first, and the string is escaped afterwards, thus truncating the last characters. (I tried to locate the bug in the sourcecode but I got lost)

As you can see in the sample, the returned strings are missing the last characters.

Note that this bug was already reported but is in the "no feedback" state, I got it re-opened but was told to report a new bug. The old bug is http://bugs.php.net/bug.php?id=32935.

Reproduce code:
---------------
<?php
print_r(snmpwalk("127.0.0.1","public", ".1.3.6.1.2.1.25.4.2.1.4"));
?>

Expected result:
----------------
The full program paths displayed, where appropriate.

Actual result:
--------------
Array ( [0] => "" [1] => "" [2] => "C:\\Program Files\\Promise
Technology, Inc.\\Promise Array Manageme" [3] => "" [4] => "" [5] =>
"C:\\users\\isms\\l" [6] => "" [7] => "C:\\WINDOWS\\System3" [8] =>
"C:\\users\\isms\\l" [9] => "\\SystemRoot\\System3" [10] => "" [11] =>
"c:\\squid\\sbi" [12] => "C:\\WINDOWS\\system3" [13] => "" [14] =>
"C:\\WINDOWS\\system3" [15] => "C:\\WINDOWS\\System3" [16] =>
"C:\\WINDOWS\\system3" [17] => "C:\\WINDOWS\\system3" [18] =>
"C:\\WINDOWS\\system3" [19] => "C:\\users\\isms\\l" [20] => "C:\\FS3"
[21] => "" [22] => "" [23] => "" [24] => "" [25] =>
"C:\\WINDOWS\\System3" [26] => "C:\\WINDOWS\\system3" [27] =>
"C:\\WINDOWS\\system3" [28] => "" [29] => "C:\\Program
Files\\TightVNC-unstabl" [30] => "C:\\PROGRA~1\\Grisoft\\AV" [31] =>
"C:\\users\\isms\\l" [32] => "C:\\Program Files\\Apache
Group\\Apache2\\" [33] => "" [34] => "C:\\PROGRA~1\\Grisoft\\AV" [35] =>
"C:\\Program Files\\Promise Technology, Inc\\Promise Array Manageme"
[36] => "C:\\PROGRA~1\\Grisoft\\AV" [37] => "C:\\WINDOWS\\system3" [38]
=> "C:\\users\\isms\\l" [39] => "" [40] => "C:\\WINDOWS\\System3" [41]
=> "C:\\users\\isms\\l" [42] => "" [43] => "C:\\FS3" [44] =>
"C:\\users\\isms\\l" [45] => "" [46] => "C:\\Program Files\\Promise
Technology, Inc.\\Promise Array Manageme" [47] => "" [48] =>
"C:\\WINDOWS" [49] => "" [50] => "C:\\PROGRA~1\\Grisoft\\AV" [51] =>
"C:\\WINDOWS" [52] => "C:\\Program Files\\ASUS\\Pro" [53] =>
"C:\\WINDOWS\\system3" [54] => "C:\\Program Files\\ATI Technologies\\ATI
Control Pan" [55] => "" [56] => "" [57] => "C:\\WINDOWS\\system32\\wb"
[58] => "C:\\Program Files\\Apache Group\\Apache2\\" [59] => "C:\\FS3"
[60] => "" [61] => "C:\\PROGRA~1\\HAUPPA~" [62] => "" [63] =>
"C:\\PROGRA~1\\HAUPPA~1\\Hardwa" [64] => "" [65] => "C:\\Program
Files\\Apache Group\\Apache2\\" [66] => "C:\\PROGRA~1\\HAUPPA~1\\Hardwa"
[67] => "" [68] => "C:\\WINDOWS\\system3" [69] => "" )

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-26 23:47 UTC] jani@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/


 [2008-11-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC