php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45893 Snmp buffer limited to 2048 char
Submitted: 2008-08-22 14:24 UTC Modified: 2011-01-31 12:50 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: nept_uno at hotmail dot com Assigned: lytboris
Status: Closed Package: SNMP related
PHP Version: 5.*, 6CVS (2009-01-21) OS: *
Private report: No CVE-ID:
 [2008-08-22 14:24 UTC] nept_uno at hotmail dot com
Description:
------------
snmpget return string with max size 2048 char. If a mib variable contains more than 2048 char, string result isn't complete.
I think that problem occurs because in file ext/snmp/snmp.c there is this declaration:
char buf[2048];
I'm trying to extend this size (i.e. 4096) but I don't know if this is the solution. 

Reproduce code:
---------------
$result = @snmpget($ip, $community, $OID_MIB, $timeout, $retries);

Expected result:
----------------
Hex-STRING: 00 01 00 03 03 F3 03 FD 03 FE 04 07 04 11 04 25 
04 2F 04 30 04 39 04 3A 04 43 04 4D 04 57 04 58 
04 6B 04 6C 04 75 04 76 04 7F 04 93 04 9D 04 A7 
04 A8 04 B1 04 BB 04 BC 04 C5 04 CF 04 D9 04 E3 
04 ED 04 F7 04 F8 05 01 05 0B 05 0C 05 15 05 1F 
05 29 05 33 05 34 05 3D 05 3E 05 47 05 48 05 51 
05 5B 05 65 05 6F 05 79 05 83 05 8D 05 8E 05 A1 
05 AB 05 B5 05 B6 05 C9 05 CA 07 E5 07 E6 07 EF 
07 F9 08 03 08 0D 08 17 08 2B 08 35 08 3F 08 40 
08 49 08 4A 08 53 08 67 08 71 08 7B 08 85 08 99 
08 A3 08 A4 08 AD 08 B7 08 B8 08 C1 08 CB 08 D5 
08 D6 08 DF 08 E9 08 EA 08 F3 08 FD 09 07 09 1B 
09 1C 09 25 09 2F 09 30 09 39 09 3A 09 43 09 4D 
09 61 09 6B 09 75 09 7F 09 80 09 89 09 93 09 9D 
09 A7 09 B1 09 B2 0B C3 0B CD 0B CE 0B D7 0B D8 
0B E1 0B EB 0B F5 0B FF 0C 00 0C 0A 0C 13 0C 14 
0C 1D 0C 1E 0C 27 0C 31 0C 3B 0C 45 0C 4F 0C 59 
0C 63 0C 6D 0C 77 0C 81 0C 82 0C 8B 0C 95 0C 9F 
0C A9 0C B3 0C BD 0C C7 0C D1 0C DB 0C DC 0C E5 
0C EF 0C F9 0D 03 0D 0D 0D 17 0D 21 0D 2B 0D 35 
0D 3F 0D 49 0D 53 0D 5D 0D 67 0D 71 0D 7B 0D 85 
0D 8F 0D 90 0D 99 0F AB 0F B5 0F BF 0F C9 0F DD 
0F E7 0F F1 0F F2 0F FB 10 05 10 06 10 0F 10 23 
10 2D 10 37 10 41 10 4B 10 55 10 56 10 5F 10 69 
10 73 10 74 10 7D 10 87 10 91 10 92 10 9B 10 A5 
10 AF 10 B0 10 B9 10 BA 10 C3 10 C4 10 CD 10 CE 
10 D7 10 E1 10 E2 10 EB 10 EC 10 F5 10 FF 11 09 
11 13 11 1D 11 27 11 31 11 3B 11 45 11 4F 11 59 
11 63 11 6D 11 77 11 81 11 82 13 9D 13 9E 13 A7 
13 B1 13 BB 13 BC 13 C5 13 CF 13 D9 13 E3 13 E4 
13 ED 13 F7 13 F8 14 01 14 02 14 0B 14 0C 14 15 
14 16 14 1F 14 29 14 33 14 3D 14 3E 14 47 14 5B 
14 65 14 6F 14 79 14 7A 14 83 14 97 14 98 14 A1 
14 AB 14 B5 14 B6 14 BF 14 C9 14 CA 14 D3 14 E7 
14 F1 14 FB 15 05 15 06 15 0F 15 19 15 23 15 24 
15 2D 15 37 15 41 15 4B 15 4C 15 55 15 56 15 5F 
17 7B 17 85 17 8F 17 99 17 A3 17 A4 17 AD 17 AE 
17 B7 17 C1 17 CB 17 D5 17 D6 17 DF 17 E0 17 E9 
17 F3 17 FD 17 FE 18 07 18 11 18 1B 18 1C 18 25 
18 2F 18 30 18 39 18 3A 18 43 18 4D 18 57 18 61 
18 62 18 75 18 7F 18 89 18 93 18 9D 18 9E 18 A7 
18 B1 18 BB 18 C5 18 CF 18 D9 18 E3 18 ED 18 EE 
18 F7 19 01 19 0B 19 0C 19 15 19 16 19 1F 19 20 
19 29 19 33 19 3D 19 3E 19 47 19 48 19 51 1B 63 
1B 6D 1B 77 1B 81 1B 8B 1B 8C 1B 95 1B 96 1B 9F 
1B A9 1B B3 1B B4 1B BD 1B BE 1B C7 1B C8 1B D1 
1B D2 1B DB 1B E5 1B EF 1B F9 1B FA 1C 03 1C 0D 
1C 17 1C 18 1C 2B 1C 35 1C 3F 1C 40 1C 53 1C 5D 
1C 5E 1C 67 1C 71 1C 7B 1C 7C 1C 85 1C 8F 1C 99 
1C A3 1C A4 1C AD 1C AE 1C B7 1C C1 1C CB 1C D5 
1C DF 1C E0 1C E9 1C F3 1C F4 1C FD 1D 07 1D 25 
1D 2F 1D 39 1F 4B 1F 56 1F 60 1F 6A 1F 74 1F 7E 
1F 92 1F 93 1F 9C 1F A6 1F B0 1F C4 1F C5 1F CE 
1F D8 1F EC 1F F6 1F F7 20 00 20 01 20 0A 20 14 
20 1E 20 1F 20 28 20 29 20 32 20 33 20 3C 20 3D 
20 46 20 50 20 51 20 5A 20 64 20 65 20 6E 20 78 
20 82 20 83 20 8C 20 96 20 97 20 A0 20 AA 20 B4 
20 B5 20 BE 20 BF 20 C8 20 D2 20 D3 20 DC 20 DD 
20 E6 20 F0 20 F1 20 FA 21 04 21 0E 21 18 21 19 
21 22 21 23 27 1B 27 1C 27 25 27 26 27 2F 27 30 
27 39 27 3A 27 43 27 44 27 4D 27 57 27 61 27 6B 
27 75 27 7F 27 80 27 89 27 93 27 9D 27 9E 27 A7 
27 A8 27 B1 27 B2 27 BB 27 BC 27 C5 27 C6 27 CF 
27 D9 27 E3 27 ED 27 F7 28 01 28 0B 28 0C 28 15 
28 16 28 1F 28 20 28 29 28 33 28 3D 28 47 28 48 
28 51 28 5B 28 65 28 66 28 6F 28 70 28 79 28 83 
28 8D 28 97 28 98 28 A1 28 AB 28 AC 28 B5 28 B6 
28 BF 28 C9 28 D3 28 D4 28 DD 28 E7 28 F1 28 F2 
2B 03 2B 17 2B 18 2B 21 2B 22 2B 2B 2B 2C 2B 35 
2B 36 2B 3F 2B 40 2B 49 2B 53 2B 5D 2B 67 2B 71 
2B 7B 2B 85 2B 8F 2B 99 2B A3 2B AD 2B B7 2B C1 
2B CB 2B D5 2B DF 2B E9 2B F3 2B FD 2C 07 2C 11 
2C 1B 2C 25 2C 2F 2C 39 2C 43 2C 4D 2C 57 2C 61 
2C 6B 2C 75 2C 76 2C 7F 2C 89 2C 93 2C 9D 2C A7 
2C B1 2C BB 2C C5 2E EC 2E F6 2F 00 2F 0A 2F 14 
2F 1E 2F 28 2F 32 2F 3C 2F 46 2F 50 2F 5A 2F 64 
2F 6E 2F 78 2F 82 2F 8C 2F 96 2F A0 2F AA 2F BE 
2F C8 2F D2 2F DC 2F E6 2F F0 2F FA 30 04 30 0E 
30 18 30 22 30 2C 30 2D 30 36 30 40 30 41 30 4A 
30 54 30 55 30 5E 30 68 30 72 30 7C 30 86 30 90 
30 91 30 9A 30 9B 30 A4 30 A5 30 AE 30 AF 30 B8 
30 B9 32 D4 32 D5 32 DE 32 DF 32 E8 32 E9 32 F2 
32 FC 33 1A 33 24 33 25 33 2E 33 2F 33 38 33 42 
33 4C 33 56 33 6A 33 6B 33 74 33 7E 33 88 


Actual result:
--------------
Hex-STRING: 00 01 00 03 03 F3 03 FD 03 FE 04 07 04 11 04 25
04 2F 04 30 04 39 04 3A 04 43 04 4D 04 57 04 58
04 6B 04 6C 04 75 04 76 04 7F 04 93 04 9D 04 A7
04 A8 04 B1 04 BB 04 BC 04 C5 04 CF 04 D9 04 E3
04 ED 04 F7 04 F8 05 01 05 0B 05 0C 05 15 05 1F
05 29 05 33 05 34 05 3D 05 3E 05 47 05 48 05 51
05 5B 05 65 05 6F 05 79 05 83 05 8D 05 8E 05 A1
05 AB 05 B5 05 B6 05 C9 05 CA 07 E5 07 E6 07 EF
07 F9 08 03 08 0D 08 17 08 2B 08 35 08 3F 08 40
08 49 08 4A 08 53 08 67 08 71 08 7B 08 85 08 99
08 A3 08 A4 08 AD 08 B7 08 B8 08 C1 08 CB 08 D5
08 D6 08 DF 08 E9 08 EA 08 F3 08 FD 09 07 09 1B
09 1C 09 25 09 2F 09 30 09 39 09 3A 09 43 09 4D
09 61 09 6B 09 75 09 7F 09 80 09 89 09 93 09 9D
09 A7 09 B1 09 B2 0B C3 0B CD 0B CE 0B D7 0B D8
0B E1 0B EB 0B F5 0B FF 0C 00 0C 0A 0C 13 0C 14
0C 1D 0C 1E 0C 27 0C 31 0C 3B 0C 45 0C 4F 0C 59
0C 63 0C 6D 0C 77 0C 81 0C 82 0C 8B 0C 95 0C 9F
0C A9 0C B3 0C BD 0C C7 0C D1 0C DB 0C DC 0C E5
0C EF 0C F9 0D 03 0D 0D 0D 17 0D 21 0D 2B 0D 35
0D 3F 0D 49 0D 53 0D 5D 0D 67 0D 71 0D 7B 0D 85
0D 8F 0D 90 0D 99 0F AB 0F B5 0F BF 0F C9 0F DD
0F E7 0F F1 0F F2 0F FB 10 05 10 06 10 0F 10 23
10 2D 10 37 10 41 10 4B 10 55 10 56 10 5F 10 69
10 73 10 74 10 7D 10 87 10 91 10 92 10 9B 10 A5
10 AF 10 B0 10 B9 10 BA 10 C3 10 C4 10 CD 10 CE
10 D7 10 E1 10 E2 10 EB 10 EC 10 F5 10 FF 11 09
11 13 11 1D 11 27 11 31 11 3B 11 45 11 4F 11 59
11 63 11 6D 11 77 11 81 11 82 13 9D 13 9E 13 A7
13 B1 13 BB 13 BC 13 C5 13 CF 13 D9 13 E3 13 E4
13 ED 13 F7 13 F8 14 01 14 02 14 0B 14 0C 14 15
14 16 14 1F 14 29 14 33 14 3D 14 3E 14 47 14 5B
14 65 14 6F 14 79 14 7A 14 83 14 97 14 98 14 A1
14 AB 14 B5 14 B6 14 BF 14 C9 14 CA 14 D3 14 E7
14 F1 14 FB 15 05 15 06 15 0F 15 19 15 23 15 24
15 2D 15 37 15 41 15 4B 15 4C 15 55 15 56 15 5F
17 7B 17 85 17 8F 17 99 17 A3 17 A4 17 AD 17 AE
17 B7 17 C1 17 CB 17 D5 17 D6 17 DF 17 E0 17 E9
17 F3 17 FD 17 FE 18 07 18 11 18 1B 18 1C 18 25
18 2F 18 30 18 39 18 3A 18 43 18 4D 18 57 18 61
18 62 18 75 18 7F 18 89 18 93

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-31 12:50 UTC] lytboris@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: lytboris
 [2011-01-31 12:50 UTC] lytboris@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

As a part of FR#53594
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Wed Apr 23 09:02:23 2014 UTC