Get rid of obsolete allowbroadcast().
Avoid core dumps in resizestring().
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 5b971f8..b77bdac 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -471,27 +471,6 @@
 }
 
 
-#if 0
-/* s.allowbroadcast() method */
-/* XXX obsolete -- will disappear in next release */
-
-static PyObject *
-BUILD_FUNC_DEF_2(PySocketSock_allowbroadcast,PySocketSockObject *,s, PyObject *,args)
-{
-	int flag;
-	int res;
-	if (!PyArg_Parse(args, "i", &flag))
-		return NULL;
-	res = setsockopt(s->sock_fd, SOL_SOCKET, SO_BROADCAST,
-			 (ANY *)&flag, sizeof flag);
-	if (res < 0)
-		return PySocket_Err();
-	Py_INCREF(Py_None);
-	return Py_None;
-}
-#endif
-
-
 /* s.setblocking(1 | 0) method */
 
 static PyObject *
@@ -789,7 +768,7 @@
 		Py_DECREF(buf);
 		return PySocket_Err();
 	}
-	if (_PyString_Resize(&buf, n) < 0)
+	if (n != len && _PyString_Resize(&buf, n) < 0)
 		return NULL;
 	return buf;
 }
@@ -826,7 +805,7 @@
 		Py_DECREF(buf);
 		return PySocket_Err();
 	}
-	if (_PyString_Resize(&buf, n) < 0)
+	if (n != len && _PyString_Resize(&buf, n) < 0)
 		return NULL;
 	addr = makesockaddr((struct sockaddr *)addrbuf, addrlen);
 	ret = Py_BuildValue("OO", buf, addr);